/*
 *  Copyright 2019-2020 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.fzhucc.modules.large.service;

import com.fzhucc.exception.BadRequestException;
import com.fzhucc.modules.appletShow.repository.AppletShowRepository;
import com.fzhucc.modules.dataCg.domain.DataCg;
import com.fzhucc.modules.dataCg.repository.DataCgRepository;
import com.fzhucc.modules.dataLls.domain.DataLls;
import com.fzhucc.modules.dataLls.repository.DataLlsRepository;
import com.fzhucc.modules.dataModel.domain.DataModel;
import com.fzhucc.modules.dataModel.repository.DataModelRepository;
import com.fzhucc.modules.dataStudio.domain.DataStudio;
import com.fzhucc.modules.dataStudio.repository.DataStudioRepository;
import com.fzhucc.modules.dataTs.domain.DataTs;
import com.fzhucc.modules.dataTs.repository.DataTsRepository;
import com.fzhucc.modules.dataXq.domain.DataXq;
import com.fzhucc.modules.dataXq.repository.DataXqRepository;
import com.fzhucc.modules.dataZcs.domain.DataZcs;
import com.fzhucc.modules.dataZcs.repository.DataZcsRepository;
import com.fzhucc.modules.dataZx.domain.DataZx;
import com.fzhucc.modules.dataZx.repository.DataZxRepository;
import com.fzhucc.modules.expert.repository.ExpertRepository;
import com.fzhucc.modules.financing.domain.Financing;
import com.fzhucc.modules.financing.repository.FinancingRepository;
import com.fzhucc.modules.hot.domain.HotRecord;
import com.fzhucc.modules.hot.repository.HotRecordRepository;
import com.fzhucc.modules.innovativeEnterprise.repository.InnovativeEnterpriseRepository;
import com.fzhucc.modules.intellectualProperty.repository.IntellectualPropertyRepository;
import com.fzhucc.modules.large.dto.*;
import com.fzhucc.modules.large.zqxdto.LargeAreaDataDto;
import com.fzhucc.modules.large.zqxdto.LargeCriticalDataDto;
import com.fzhucc.modules.notice.repository.NoticeRepository;
import com.fzhucc.modules.pms.domain.Project;
import com.fzhucc.modules.pms.repository.ProjectRepository;
import com.fzhucc.modules.sciPersonnelInfo.domain.SciPersonnelInfo;
import com.fzhucc.modules.sciPersonnelInfo.domain.dto.SciPersonnelInfoQueryCriteria;
import com.fzhucc.modules.sciPersonnelInfo.repository.SciPersonnelInfoRepository;
import com.fzhucc.modules.sciStudio.repository.SciStudioRepository;
import com.fzhucc.modules.sciTdStatusLog.repository.SciTechnologyDemandPpLogRepository;
import com.fzhucc.modules.sciTechnologyDemand.domain.SciTechnologyDemand;
import com.fzhucc.modules.sciTechnologyDemand.domain.dto.SciTechnologyDemandDto;
import com.fzhucc.modules.sciTechnologyDemand.repository.SciTechnologyDemandRepository;
import com.fzhucc.modules.sciTechnologyDemand.service.mapstruct.SciTechnologyDemandMapper;
import com.fzhucc.modules.subject.domain.dto.SubjectHighfieldsType1ResultH5;
import com.fzhucc.modules.subject.domain.entity.SubjectHighfieldsType2;
import com.fzhucc.modules.subject.domain.entity.SubjectHighfieldsType3;
import com.fzhucc.modules.subject.repository.SubjectHighfieldsType2Repository;
import com.fzhucc.modules.subject.repository.SubjectHighfieldsType3Repository;
import com.fzhucc.modules.system.domain.User;
import com.fzhucc.modules.system.repository.UserRepository;
import com.fzhucc.modules.thinktank.repository.CapitalRepository;
import com.fzhucc.modules.thinktank.repository.CompanyRepository;
import com.fzhucc.modules.thinktank.repository.LeaderRepository;
import com.fzhucc.modules.ts.domain.TsTeam;
import com.fzhucc.modules.ts.repository.TsTeamRepository;
import com.fzhucc.utils.SecurityUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.print.DocFlavor;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @author yyg
 * @website https://eladmin.vip
 * @description 服务实现
 * @date 2024-01-04
 **/
@Service
@RequiredArgsConstructor
public class LargeZqxService {

    private final SubjectHighfieldsType3Repository subjectHighfieldsType3Repository;

    private final SubjectHighfieldsType2Repository subjectHighfieldsType2Repository;

    private final SciTechnologyDemandPpLogRepository sciTechnologyDemandPpLogRepository;

    private final HotRecordRepository hotRecordRepository;

    private final UserRepository userRepository;

    private final DataLlsRepository dataLlsRepository;

    private final DataZcsRepository dataZcsRepository;

    @Value("${org.area.all2}")
    public String fjsstr;

    @Value("${sci.audit.shtg}")
    public String shtg;

    @Value("${sci.doStatus}")
    public String ppz;

    @Value("${sci.doStatusypp}")
    public String ypp;

    @Value("${sci.doStatusyjj}")
    public String yjj;


    public static final String FZ = "%福州市%";
    public static final String FJS = "%福建省%";
    public static final String PT = "%莆田市%";
    public static final String QZ = "%泉州市%";
    public static final String XM = "%厦门市%";
    public static final String ZZ = "%漳州市%";
    public static final String LY = "%龙岩市%";
    public static final String SM = "%三明市%";
    public static final String NP = "%南平市%";
    public static final String ND = "%宁德市%";
    public static final String S1 = "%省财贸轻纺烟草医疗工会工委%";
    public static final String S2 = "%省机械化工矿冶工会工委%";
    public static final String S3 = "%省教科文卫体工会工委%";
    public static final String S4 = "%省信息产业工会工委%";
    public static final String S5 = "%省林业工会%";
    public static final String S6 = "%省交通工会%";
    public static final String S7 = "%省建设建材工会%";
    public static final String S8 = "%省数字经济产业工会%";
    public static final String PTANG = "%平潭综合实验区%";

    public static final String FZCITY = "福州市";
    public static final String FJSCITY = "福建省";
    public static final String PTCITY = "莆田市";
    public static final String QZCITY = "泉州市";
    public static final String XMCITY = "厦门市";
    public static final String ZZCITY = "漳州市";
    public static final String LYCITY = "龙岩市";
    public static final String SMCITY = "三明市";
    public static final String NPCITY = "南平市";
    public static final String NDCITY = "宁德市";
    public static final String S1CITY = "省财贸轻纺烟草医疗工会工委";
    public static final String S2CITY = "省机械化工矿冶工会工委";
    public static final String S3CITY = "省教科文卫体工会工委";
    public static final String S4CITY = "省信息产业工会工委";
    public static final String S5CITY = "省林业工会";
    public static final String S6CITY = "省交通工会";
    public static final String S7CITY = "省建设建材工会";
    public static final String S8CITY = "省数字经济产业工会";
    public static final String PTANGCITY = "平潭综合实验区";

    private final ProjectRepository projectRepository;

    private final SciTechnologyDemandRepository sciTechnologyDemandRepository;

    private final SciPersonnelInfoRepository sciPersonnelInfoRepository;

    private final TsTeamRepository tsTeamRepository;

    private final SciTechnologyDemandMapper sciTechnologyDemandMapper;

    private final SciStudioRepository sciStudioRepository;

    private final NoticeRepository noticeRepository;

    private final DataModelRepository dataModelRepository;

    private final DataCgRepository dataCgRepository;

    private final DataStudioRepository dataStudioRepository;

    private final DataTsRepository dataTsRepository;

    private final DataXqRepository dataXqRepository;

    private final DataZxRepository dataZxRepository;

    //获取当前日期7天前
    public Date getSevenDateBefore() {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, -7); // 减去7天
        Date sevenDaysBefore = calendar.getTime();
        return sevenDaysBefore;
    }


    public String conLikeArea(String area) {
        if (area == null) {
            return "";
        }
        if (area.contains(FZCITY)) {
            return FZ;
        }
        if (area.contains(FJSCITY)) {
            return FJS;
        }
        if (area.contains(PTCITY)) {
            return PT;
        }
        if (area.contains(QZCITY)) {
            return QZ;
        }
        if (area.contains(XMCITY)) {
            return XM;
        }
        if (area.contains(ZZCITY)) {
            return ZZ;
        }
        if (area.contains(LYCITY)) {
            return LY;
        }
        if (area.contains(SMCITY)) {
            return SM;
        }
        if (area.contains(NPCITY)) {
            return NP;
        }
        if (area.contains(NDCITY)) {
            return ND;
        }
        if (area.contains(S1CITY)) {
            return S1;
        }
        if (area.contains(S2CITY)) {
            return S2;
        }
        if (area.contains(S3CITY)) {
            return S3;
        }
        if (area.contains(S4CITY)) {
            return S4;
        }
        if (area.contains(S5CITY)) {
            return S5;
        }
        if (area.contains(S6CITY)) {
            return S6;
        }
        if (area.contains(S7CITY)) {
            return S7;
        }
        if (area.contains(S8CITY)) {
            return S8;
        }
        if (area.contains(PTANGCITY)) {
            return PTANG;
        }
        return "";
    }

    //TODO 根据登录用户为哪个地区的显示哪个地区的数据
    public String getLoginArea() {
        Long userId = null;
        try {
            userId = SecurityUtils.getCurrentUserId();
        } catch (Exception e) {
            return "";
        }
        if (userId != null) {
            Optional<User> userOptional = userRepository.findById(userId);
            User res = userOptional.get();
            String orgArea = res.getOrgArea();
            if (orgArea != null && orgArea.contains(";")) {
                String[] split = orgArea.split(";");
                if (split.length == 1) {//说明只有福建省待完善
                    return split[0];//暂时返回福建省
                } else if (split.length == 2) {
                    return split[1];
                } else if (split.length == 3) {
                    return split[1];
                } else {
                    return "";
                }
            } else {
                return "";
            }
        } else {
            return "";
        }
    }

    public LargeCriticalDataDto getdata1(String area) {
        LargeCriticalDataDto dto = new LargeCriticalDataDto();
        int cx = 0;//创新成果数
        int xq = 0;//企业需求数
        int lm = 0;//劳模工匠数
        int js = 0;//技术服务队数
        List<SciTechnologyDemand> xqlist = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShow(area, shtg);
        if (xqlist != null) {
            xq = xqlist.size();
        }
        List<SciPersonnelInfo> lmlist = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShow(area, shtg);
        if (lmlist != null) {
            lm = lmlist.size();
        }
        List<TsTeam> jslist = tsTeamRepository.findNormalByLikeAreaWithOutIsShow(area, shtg);
        if (jslist != null) {
            js = jslist.size();
        }
        List<Project> cxlist = projectRepository.findNormalByLikeArea(area);
        if (cxlist != null) {
            cx = cxlist.size();
        }
        dto.setCxresults(cx);
        dto.setQydemands(xq);
        dto.setModels(lm);
        dto.setTeams(js);

        int a1 = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShowCSeven(area, shtg, getSevenDateBefore());
        int a2 = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShowDSeven(area, shtg, getSevenDateBefore());
        dto.setQydemandsSeven(a1 - a2);

        int a3 = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShowCSeven(area, shtg, getSevenDateBefore());
        int a4 = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShowDSeven(area, shtg, getSevenDateBefore());
        dto.setModelsSeven(a3 - a4);

        int a5 = tsTeamRepository.findNormalByLikeAreaWithOutIsShowCSeven(area, shtg, getSevenDateBefore());
        int a6 = tsTeamRepository.findNormalByLikeAreaWithOutIsShowDSeven(area, shtg, getSevenDateBefore());
        dto.setTeamsSeven(a5 - a6);

        int a7 = projectRepository.findNormalByLikeAreaWithOutIsShowCSeven(area, getSevenDateBefore());
        int a8 = projectRepository.findNormalByLikeAreaWithOutIsShowDSeven(area, getSevenDateBefore());
        dto.setCxresultsSeven(a7 - a8);
        return dto;
    }

    public LargeCriticalDataDto getdata1FJS(String area) {
        LargeCriticalDataDto dto = new LargeCriticalDataDto();
        int cx = 0;//创新成果数
        int xq = 0;//企业需求数
        int lm = 0;//劳模工匠数
        int js = 0;//技术服务队数
        List<SciTechnologyDemand> xqlist = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShowFJS(shtg);
        if (xqlist != null) {
            xq = xqlist.size();
        }
        List<SciPersonnelInfo> lmlist = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShowFJS(shtg);
        if (lmlist != null) {
            lm = lmlist.size();
        }
        List<TsTeam> jslist = tsTeamRepository.findNormalByLikeAreaWithOutIsShowFJS(shtg);
        if (jslist != null) {
            js = jslist.size();
        }
        List<Project> cxlist = projectRepository.findNormalByLikeAreaFJS();
        if (cxlist != null) {
            cx = cxlist.size();
        }
        dto.setCxresults(cx);
        dto.setQydemands(xq);
        dto.setModels(lm);
        dto.setTeams(js);

        int a1 = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShowCSevenFJS(shtg, getSevenDateBefore());
        int a2 = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShowDSevenFJS(shtg, getSevenDateBefore());
        dto.setQydemandsSeven(a1 - a2);

        int a3 = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShowCSevenFJS(shtg, getSevenDateBefore());
        int a4 = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShowDSevenFJS(shtg, getSevenDateBefore());
        dto.setModelsSeven(a3 - a4);

        int a5 = tsTeamRepository.findNormalByLikeAreaWithOutIsShowCSevenFJS(shtg, getSevenDateBefore());
        int a6 = tsTeamRepository.findNormalByLikeAreaWithOutIsShowDSevenFJS(shtg, getSevenDateBefore());
        dto.setTeamsSeven(a5 - a6);

        int a7 = projectRepository.findNormalByLikeAreaWithOutIsShowCSevenFJS(getSevenDateBefore());
        int a8 = projectRepository.findNormalByLikeAreaWithOutIsShowDSevenFJS(getSevenDateBefore());
        dto.setCxresultsSeven(a7 - a8);
        return dto;
    }


    public LargeCriticalDataDto getCriticalData() {
        String loginArea = getLoginArea();
        if (loginArea != null && !loginArea.equals("")) {
            String conLikeArea = conLikeArea(loginArea);
            if (conLikeArea != null && conLikeArea.contains(FJSCITY)) {
                LargeCriticalDataDto largeCriticalDataDto = getdata1FJS(conLikeArea);
                return largeCriticalDataDto;
            } else {
                LargeCriticalDataDto largeCriticalDataDto = getdata1(conLikeArea);
                return largeCriticalDataDto;
            }
        } else {
            LargeCriticalDataDto largeCriticalDataDto = new LargeCriticalDataDto();
            return largeCriticalDataDto;
        }
    }

    public List<Object> getDemndsAllAreasCount() {

        //根据登录的用户 展示数据情况  福建省暂时展示 福州市
        String loginArea = getLoginArea();
        List<SubjectHighfieldsType3> list = new ArrayList<SubjectHighfieldsType3>();
        if (loginArea != null && loginArea.contains(FJSCITY)) {
            //list = subjectHighfieldsType3Repository.findByHighfields2(FZCITY, "1");
            //todo 福建省单独做返回  第二级数据
            List<SubjectHighfieldsType2> list2 = subjectHighfieldsType2Repository.findByHighfields1(FJSCITY, "1");
            List<Object> result = new ArrayList<Object>();

            if (list2 != null && list2.size() > 0) {
                for (int i = 0; i < list2.size(); i++) {
                    SubjectHighfieldsType2 subjectHighfieldsType2 = list2.get(i);
                    String highfields = subjectHighfieldsType2.getHighfields2();

                    List<SciTechnologyDemand> listshtg = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShow("%" + highfields + "%", shtg);
                    List<SciTechnologyDemand> listshtg2 = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShowNoPass("%" + highfields + "%", shtg);


                    int a1 = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShowCSeven("%" + highfields + "%", shtg, getSevenDateBefore());
                    int a2 = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShowDSeven("%" + highfields + "%", shtg, getSevenDateBefore());

                    //TODO 隐藏本级
                    if (!highfields.contains("本级")) {
                        LinkedHashMap<String, Object> jsonMap = new LinkedHashMap<String, Object>();
                        jsonMap.put("name", highfields);
                        jsonMap.put("value", listshtg.size());
                        jsonMap.put("value2", listshtg2.size());
                        jsonMap.put("value3", a1 - a2);//7天内新增删除差值
                        result.add(jsonMap);
                    }
                }
            }
            return result;
        }
        if (loginArea != null && loginArea.contains(FZCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(FZCITY, "1");
        }
        if (loginArea != null && loginArea.contains(PTCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(PTCITY, "1");
        }
        if (loginArea != null && loginArea.contains(QZCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(QZCITY, "1");
        }
        if (loginArea != null && loginArea.contains(XMCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(XMCITY, "1");
        }
        if (loginArea != null && loginArea.contains(ZZCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(ZZCITY, "1");
        }
        if (loginArea != null && loginArea.contains(LYCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(LYCITY, "1");
        }
        if (loginArea != null && loginArea.contains(SMCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(SMCITY, "1");
        }
        if (loginArea != null && loginArea.contains(NPCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(NPCITY, "1");
        }
        if (loginArea != null && loginArea.contains(NPCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(NPCITY, "1");
        }
        if (loginArea != null && loginArea.contains(NDCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(NDCITY, "1");
        }
        if (loginArea != null && loginArea.contains(S1CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S1CITY, "1");
        }
        if (loginArea != null && loginArea.contains(S2CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S2CITY, "1");
        }
        if (loginArea != null && loginArea.contains(S3CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S3CITY, "1");
        }
        if (loginArea != null && loginArea.contains(S4CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S4CITY, "1");
        }
        if (loginArea != null && loginArea.contains(S5CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S5CITY, "1");
        }
        if (loginArea != null && loginArea.contains(S6CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S6CITY, "1");
        }
        if (loginArea != null && loginArea.contains(S7CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S7CITY, "1");
        }
        if (loginArea != null && loginArea.contains(S8CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S8CITY, "1");
        }
        if (loginArea != null && loginArea.contains(PTANGCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(PTANGCITY, "1");
        }

        List<Object> result = new ArrayList<Object>();

        if (list != null && list.size() > 0) {
            for (int i = 0; i < list.size(); i++) {
                SubjectHighfieldsType3 data = list.get(i);
                String highfields3 = data.getHighfields3();

                List<SciTechnologyDemand> listshtg = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShow("%" + highfields3 + "%", shtg);
                List<SciTechnologyDemand> listshtg2 = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShowNoPass("%" + highfields3 + "%", shtg);

                int a1 = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShowCSeven("%" + highfields3 + "%", shtg, getSevenDateBefore());
                int a2 = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShowDSeven("%" + highfields3 + "%", shtg, getSevenDateBefore());

                if (!highfields3.contains("本级")) {
                    LinkedHashMap<String, Object> jsonMap = new LinkedHashMap<String, Object>();
                    jsonMap.put("name", highfields3);
                    jsonMap.put("value", listshtg.size());
                    jsonMap.put("value2", listshtg2.size());
                    jsonMap.put("value3", a1 - a2);//7天内新增删除差值
                    result.add(jsonMap);
                }
            }
        }
        return result;
    }

    public List<Object> getModelsAllAreasCount() {
        //根据登录的用户 展示数据情况  福建省暂时展示 福州市
        String loginArea = getLoginArea();
        List<SubjectHighfieldsType3> list = new ArrayList<SubjectHighfieldsType3>();
        if (loginArea != null && loginArea.contains(FJSCITY)) {
            //list = subjectHighfieldsType3Repository.findByHighfields2(FZCITY, "1");

            //todo 福建省单独做返回  第二级数据
            List<SubjectHighfieldsType2> list2 = subjectHighfieldsType2Repository.findByHighfields1(FJSCITY, "1");
            List<Object> result = new ArrayList<Object>();

            if (list2 != null && list2.size() > 0) {
                for (int i = 0; i < list2.size(); i++) {
                    SubjectHighfieldsType2 subjectHighfieldsType2 = list2.get(i);
                    String highfields = subjectHighfieldsType2.getHighfields2();

                    List<SciPersonnelInfo> listshtg = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShow("%" + highfields + "%", shtg);
                    List<SciPersonnelInfo> listshtg2 = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShowNoPass("%" + highfields + "%", shtg);

                    int a1 = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShowCSeven("%" + highfields + "%", shtg, getSevenDateBefore());
                    int a2 = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShowDSeven("%" + highfields + "%", shtg, getSevenDateBefore());

                    if (!highfields.contains("本级")) {
                        LinkedHashMap<String, Object> jsonMap = new LinkedHashMap<String, Object>();
                        jsonMap.put("name", highfields);
                        jsonMap.put("value", listshtg.size());
                        jsonMap.put("value2", listshtg2.size());
                        jsonMap.put("value3", a1 - a2);//7天内新增删除差值
                        result.add(jsonMap);
                    }
                }
            }
            return result;
        }
        if (loginArea != null && loginArea.contains(FZCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(FZCITY, "1");
        }
        if (loginArea != null && loginArea.contains(PTCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(PTCITY, "1");
        }
        if (loginArea != null && loginArea.contains(QZCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(QZCITY, "1");
        }
        if (loginArea != null && loginArea.contains(XMCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(XMCITY, "1");
        }
        if (loginArea != null && loginArea.contains(ZZCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(ZZCITY, "1");
        }
        if (loginArea != null && loginArea.contains(LYCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(LYCITY, "1");
        }
        if (loginArea != null && loginArea.contains(SMCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(SMCITY, "1");
        }
        if (loginArea != null && loginArea.contains(NPCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(NPCITY, "1");
        }
        if (loginArea != null && loginArea.contains(NPCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(NPCITY, "1");
        }
        if (loginArea != null && loginArea.contains(NDCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(NDCITY, "1");
        }
        if (loginArea != null && loginArea.contains(S1CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S1CITY, "1");
        }
        if (loginArea != null && loginArea.contains(S2CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S2CITY, "1");
        }
        if (loginArea != null && loginArea.contains(S3CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S3CITY, "1");
        }
        if (loginArea != null && loginArea.contains(S4CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S4CITY, "1");
        }
        if (loginArea != null && loginArea.contains(S5CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S5CITY, "1");
        }
        if (loginArea != null && loginArea.contains(S6CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S6CITY, "1");
        }
        if (loginArea != null && loginArea.contains(S7CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S7CITY, "1");
        }
        if (loginArea != null && loginArea.contains(S8CITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(S8CITY, "1");
        }
        if (loginArea != null && loginArea.contains(PTANGCITY)) {
            list = subjectHighfieldsType3Repository.findByHighfields2(PTANGCITY, "1");
        }

        List<Object> result = new ArrayList<Object>();

        if (list != null && list.size() > 0) {
            for (int i = 0; i < list.size(); i++) {
                SubjectHighfieldsType3 data = list.get(i);
                String highfields3 = data.getHighfields3();

                List<SciPersonnelInfo> listshtg = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShow("%" + highfields3 + "%", shtg);
                List<SciPersonnelInfo> listshtg2 = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShowNoPass("%" + highfields3 + "%", shtg);


                int a1 = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShowCSeven("%" + highfields3 + "%", shtg, getSevenDateBefore());
                int a2 = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShowDSeven("%" + highfields3 + "%", shtg, getSevenDateBefore());

                if (!highfields3.contains("本级")) {
                    LinkedHashMap<String, Object> jsonMap = new LinkedHashMap<String, Object>();
                    jsonMap.put("name", highfields3);
                    jsonMap.put("value", listshtg.size());
                    jsonMap.put("value2", listshtg2.size());
                    jsonMap.put("value3", a1 - a2);//7天内新增删除差值
                    result.add(jsonMap);
                }
            }
        }
        return result;
    }


    public List<Object> getdata2(String area) {
        //technology字段
        int jx = 0;//机械、电机
        int dz = 0;//电子、通讯
        int yl = 0;//医疗、保健
        int qg = 0;//轻工、纺织
        int zy = 0;//资源、环保
        int jt = 0;//交通、建筑
        int xcl = 0;//新材料
        int qita = 0;//其他

        String jx_str = "%机械、电机%";
        String dz_str = "%电子、通讯%";
        String yl_str = "%医疗、保健%";
        String qg_str = "%轻工、纺织%";
        String zy_str = "%资源、环保%";
        String jt_str = "%交通、建筑%";
        String xcl_str = "%新材料%";
        String qita_str = "%其他%";

        List<SciTechnologyDemand> jxlist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShow(jx_str, shtg, area);
        if (jxlist != null) {
            jx = jxlist.size();
        }
        List<SciTechnologyDemand> dzlist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShow(dz_str, shtg, area);
        if (dzlist != null) {
            dz = dzlist.size();
        }
        List<SciTechnologyDemand> yllist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShow(yl_str, shtg, area);
        if (yllist != null) {
            yl = yllist.size();
        }
        List<SciTechnologyDemand> qglist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShow(qg_str, shtg, area);
        if (qglist != null) {
            qg = qglist.size();
        }
        List<SciTechnologyDemand> zylist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShow(zy_str, shtg, area);
        if (zylist != null) {
            zy = zylist.size();
        }
        List<SciTechnologyDemand> jtlist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShow(jt_str, shtg, area);
        if (jtlist != null) {
            jt = jtlist.size();
        }
        List<SciTechnologyDemand> xcllist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShow(xcl_str, shtg, area);
        if (xcllist != null) {
            xcl = xcllist.size();
        }
        List<SciTechnologyDemand> qitalist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShow(qita_str, shtg, area);
        if (qitalist != null) {
            qita = qitalist.size();
        }

        List<Object> list = new ArrayList<Object>();

        LinkedHashMap<String, Object> jsonMap1 = new LinkedHashMap<String, Object>();
        jsonMap1.put("name", "机械、电机");
        jsonMap1.put("value", jx);
        list.add(jsonMap1);

        LinkedHashMap<String, Object> jsonMap2 = new LinkedHashMap<String, Object>();
        jsonMap2.put("name", "电子、通讯");
        jsonMap2.put("value", dz);
        list.add(jsonMap2);

        LinkedHashMap<String, Object> jsonMap3 = new LinkedHashMap<String, Object>();
        jsonMap3.put("name", "医疗、保健");
        jsonMap3.put("value", yl);
        list.add(jsonMap3);

        LinkedHashMap<String, Object> jsonMap4 = new LinkedHashMap<String, Object>();
        jsonMap4.put("name", "轻工、纺织");
        jsonMap4.put("value", qg);
        list.add(jsonMap4);

        LinkedHashMap<String, Object> jsonMap5 = new LinkedHashMap<String, Object>();
        jsonMap5.put("name", "资源、环保");
        jsonMap5.put("value", zy);
        list.add(jsonMap5);

        LinkedHashMap<String, Object> jsonMap6 = new LinkedHashMap<String, Object>();
        jsonMap6.put("name", "交通、建筑");
        jsonMap6.put("value", jt);
        list.add(jsonMap6);

        LinkedHashMap<String, Object> jsonMap7 = new LinkedHashMap<String, Object>();
        jsonMap7.put("name", "新材料");
        jsonMap7.put("value", xcl);
        list.add(jsonMap7);

        LinkedHashMap<String, Object> jsonMap8 = new LinkedHashMap<String, Object>();
        jsonMap8.put("name", "其他");
        jsonMap8.put("value", qita);
        list.add(jsonMap8);

        return list;
    }

    public List<Object> getdata2FJS(String area) {
        //technology字段
        int jx = 0;//机械、电机
        int dz = 0;//电子、通讯
        int yl = 0;//医疗、保健
        int qg = 0;//轻工、纺织
        int zy = 0;//资源、环保
        int jt = 0;//交通、建筑
        int xcl = 0;//新材料
        int qita = 0;//其他

        String jx_str = "%机械、电机%";
        String dz_str = "%电子、通讯%";
        String yl_str = "%医疗、保健%";
        String qg_str = "%轻工、纺织%";
        String zy_str = "%资源、环保%";
        String jt_str = "%交通、建筑%";
        String xcl_str = "%新材料%";
        String qita_str = "%其他%";

        List<SciTechnologyDemand> jxlist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShowFJS(jx_str, shtg);
        if (jxlist != null) {
            jx = jxlist.size();
        }
        List<SciTechnologyDemand> dzlist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShowFJS(dz_str, shtg);
        if (dzlist != null) {
            dz = dzlist.size();
        }
        List<SciTechnologyDemand> yllist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShowFJS(yl_str, shtg);
        if (yllist != null) {
            yl = yllist.size();
        }
        List<SciTechnologyDemand> qglist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShowFJS(qg_str, shtg);
        if (qglist != null) {
            qg = qglist.size();
        }
        List<SciTechnologyDemand> zylist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShowFJS(zy_str, shtg);
        if (zylist != null) {
            zy = zylist.size();
        }
        List<SciTechnologyDemand> jtlist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShowFJS(jt_str, shtg);
        if (jtlist != null) {
            jt = jtlist.size();
        }
        List<SciTechnologyDemand> xcllist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShowFJS(xcl_str, shtg);
        if (xcllist != null) {
            xcl = xcllist.size();
        }
        List<SciTechnologyDemand> qitalist = sciTechnologyDemandRepository.findNormalByLikeTechnologyWithOutIsShowFJS(qita_str, shtg);
        if (qitalist != null) {
            qita = qitalist.size();
        }

        List<Object> list = new ArrayList<Object>();

        LinkedHashMap<String, Object> jsonMap1 = new LinkedHashMap<String, Object>();
        jsonMap1.put("name", "机械、电机");
        jsonMap1.put("value", jx);
        list.add(jsonMap1);

        LinkedHashMap<String, Object> jsonMap2 = new LinkedHashMap<String, Object>();
        jsonMap2.put("name", "电子、通讯");
        jsonMap2.put("value", dz);
        list.add(jsonMap2);

        LinkedHashMap<String, Object> jsonMap3 = new LinkedHashMap<String, Object>();
        jsonMap3.put("name", "医疗、保健");
        jsonMap3.put("value", yl);
        list.add(jsonMap3);

        LinkedHashMap<String, Object> jsonMap4 = new LinkedHashMap<String, Object>();
        jsonMap4.put("name", "轻工、纺织");
        jsonMap4.put("value", qg);
        list.add(jsonMap4);

        LinkedHashMap<String, Object> jsonMap5 = new LinkedHashMap<String, Object>();
        jsonMap5.put("name", "资源、环保");
        jsonMap5.put("value", zy);
        list.add(jsonMap5);

        LinkedHashMap<String, Object> jsonMap6 = new LinkedHashMap<String, Object>();
        jsonMap6.put("name", "交通、建筑");
        jsonMap6.put("value", jt);
        list.add(jsonMap6);

        LinkedHashMap<String, Object> jsonMap7 = new LinkedHashMap<String, Object>();
        jsonMap7.put("name", "新材料");
        jsonMap7.put("value", xcl);
        list.add(jsonMap7);

        LinkedHashMap<String, Object> jsonMap8 = new LinkedHashMap<String, Object>();
        jsonMap8.put("name", "其他");
        jsonMap8.put("value", qita);
        list.add(jsonMap8);

        return list;
    }


    public List<Object> getDemandsPie() {
        String loginArea = getLoginArea();
        if (loginArea != null && !loginArea.equals("")) {
            String conLikeArea = conLikeArea(loginArea);
            if (conLikeArea != null && conLikeArea.contains(FJSCITY)) {
                List<Object> objects = getdata2FJS(conLikeArea);
                return objects;
            } else {
                List<Object> objects = getdata2(conLikeArea);
                return objects;
            }
        } else {
            return null;
        }
    }


    public List<Object> getdata3(String area) {
        //technology字段
        int jx = 0;//机械、电机
        int dz = 0;//电子、通讯
        int yl = 0;//医疗、保健
        int qg = 0;//轻工、纺织
        int zy = 0;//资源、环保
        int jt = 0;//交通、建筑
        int xcl = 0;//新材料
        int qita = 0;//其他

        String jx_str = "%机械、电机%";
        String dz_str = "%电子、通讯%";
        String yl_str = "%医疗、保健%";
        String qg_str = "%轻工、纺织%";
        String zy_str = "%资源、环保%";
        String jt_str = "%交通、建筑%";
        String xcl_str = "%新材料%";
        String qita_str = "%其他%";

        List<SciPersonnelInfo> jxlist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShow(jx_str, shtg, area);
        if (jxlist != null) {
            jx = jxlist.size();
        }
        List<SciPersonnelInfo> dzlist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShow(dz_str, shtg, area);
        if (dzlist != null) {
            dz = dzlist.size();
        }
        List<SciPersonnelInfo> yllist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShow(yl_str, shtg, area);
        if (yllist != null) {
            yl = yllist.size();
        }
        List<SciPersonnelInfo> qglist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShow(qg_str, shtg, area);
        if (qglist != null) {
            qg = qglist.size();
        }
        List<SciPersonnelInfo> zylist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShow(zy_str, shtg, area);
        if (zylist != null) {
            zy = zylist.size();
        }
        List<SciPersonnelInfo> jtlist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShow(jt_str, shtg, area);
        if (jtlist != null) {
            jt = jtlist.size();
        }
        List<SciPersonnelInfo> xcllist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShow(xcl_str, shtg, area);
        if (xcllist != null) {
            xcl = xcllist.size();
        }
        List<SciPersonnelInfo> qitalist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShow(qita_str, shtg, area);
        if (qitalist != null) {
            qita = qitalist.size();
        }

        List<Object> list = new ArrayList<Object>();

        LinkedHashMap<String, Object> jsonMap1 = new LinkedHashMap<String, Object>();
        jsonMap1.put("name", "机械、电机");
        jsonMap1.put("value", jx);
        list.add(jsonMap1);

        LinkedHashMap<String, Object> jsonMap2 = new LinkedHashMap<String, Object>();
        jsonMap2.put("name", "电子、通讯");
        jsonMap2.put("value", dz);
        list.add(jsonMap2);

        LinkedHashMap<String, Object> jsonMap3 = new LinkedHashMap<String, Object>();
        jsonMap3.put("name", "医疗、保健");
        jsonMap3.put("value", yl);
        list.add(jsonMap3);

        LinkedHashMap<String, Object> jsonMap4 = new LinkedHashMap<String, Object>();
        jsonMap4.put("name", "轻工、纺织");
        jsonMap4.put("value", qg);
        list.add(jsonMap4);

        LinkedHashMap<String, Object> jsonMap5 = new LinkedHashMap<String, Object>();
        jsonMap5.put("name", "资源、环保");
        jsonMap5.put("value", zy);
        list.add(jsonMap5);

        LinkedHashMap<String, Object> jsonMap6 = new LinkedHashMap<String, Object>();
        jsonMap6.put("name", "交通、建筑");
        jsonMap6.put("value", jt);
        list.add(jsonMap6);

        LinkedHashMap<String, Object> jsonMap7 = new LinkedHashMap<String, Object>();
        jsonMap7.put("name", "新材料");
        jsonMap7.put("value", xcl);
        list.add(jsonMap7);

        LinkedHashMap<String, Object> jsonMap8 = new LinkedHashMap<String, Object>();
        jsonMap8.put("name", "其他");
        jsonMap8.put("value", qita);
        list.add(jsonMap8);

        return list;
    }

    public List<Object> getdata3FJS(String area) {
        //technology字段
        int jx = 0;//机械、电机
        int dz = 0;//电子、通讯
        int yl = 0;//医疗、保健
        int qg = 0;//轻工、纺织
        int zy = 0;//资源、环保
        int jt = 0;//交通、建筑
        int xcl = 0;//新材料
        int qita = 0;//其他

        String jx_str = "%机械、电机%";
        String dz_str = "%电子、通讯%";
        String yl_str = "%医疗、保健%";
        String qg_str = "%轻工、纺织%";
        String zy_str = "%资源、环保%";
        String jt_str = "%交通、建筑%";
        String xcl_str = "%新材料%";
        String qita_str = "%其他%";

        List<SciPersonnelInfo> jxlist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShowFJS(jx_str, shtg);
        if (jxlist != null) {
            jx = jxlist.size();
        }
        List<SciPersonnelInfo> dzlist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShowFJS(dz_str, shtg);
        if (dzlist != null) {
            dz = dzlist.size();
        }
        List<SciPersonnelInfo> yllist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShowFJS(yl_str, shtg);
        if (yllist != null) {
            yl = yllist.size();
        }
        List<SciPersonnelInfo> qglist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShowFJS(qg_str, shtg);
        if (qglist != null) {
            qg = qglist.size();
        }
        List<SciPersonnelInfo> zylist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShowFJS(zy_str, shtg);
        if (zylist != null) {
            zy = zylist.size();
        }
        List<SciPersonnelInfo> jtlist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShowFJS(jt_str, shtg);
        if (jtlist != null) {
            jt = jtlist.size();
        }
        List<SciPersonnelInfo> xcllist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShowFJS(xcl_str, shtg);
        if (xcllist != null) {
            xcl = xcllist.size();
        }
        List<SciPersonnelInfo> qitalist = sciPersonnelInfoRepository.findNormalByLikeTechnologyWithOutIsShowFJS(qita_str, shtg);
        if (qitalist != null) {
            qita = qitalist.size();
        }

        List<Object> list = new ArrayList<Object>();

        LinkedHashMap<String, Object> jsonMap1 = new LinkedHashMap<String, Object>();
        jsonMap1.put("name", "机械、电机");
        jsonMap1.put("value", jx);
        list.add(jsonMap1);

        LinkedHashMap<String, Object> jsonMap2 = new LinkedHashMap<String, Object>();
        jsonMap2.put("name", "电子、通讯");
        jsonMap2.put("value", dz);
        list.add(jsonMap2);

        LinkedHashMap<String, Object> jsonMap3 = new LinkedHashMap<String, Object>();
        jsonMap3.put("name", "医疗、保健");
        jsonMap3.put("value", yl);
        list.add(jsonMap3);

        LinkedHashMap<String, Object> jsonMap4 = new LinkedHashMap<String, Object>();
        jsonMap4.put("name", "轻工、纺织");
        jsonMap4.put("value", qg);
        list.add(jsonMap4);

        LinkedHashMap<String, Object> jsonMap5 = new LinkedHashMap<String, Object>();
        jsonMap5.put("name", "资源、环保");
        jsonMap5.put("value", zy);
        list.add(jsonMap5);

        LinkedHashMap<String, Object> jsonMap6 = new LinkedHashMap<String, Object>();
        jsonMap6.put("name", "交通、建筑");
        jsonMap6.put("value", jt);
        list.add(jsonMap6);

        LinkedHashMap<String, Object> jsonMap7 = new LinkedHashMap<String, Object>();
        jsonMap7.put("name", "新材料");
        jsonMap7.put("value", xcl);
        list.add(jsonMap7);

        LinkedHashMap<String, Object> jsonMap8 = new LinkedHashMap<String, Object>();
        jsonMap8.put("name", "其他");
        jsonMap8.put("value", qita);
        list.add(jsonMap8);

        return list;
    }

    public List<Object> getModelsPie() {
        String loginArea = getLoginArea();
        if (loginArea != null && !loginArea.equals("")) {
            String conLikeArea = conLikeArea(loginArea);
            if (conLikeArea != null && conLikeArea.contains(FJSCITY)) {
                List<Object> objects = getdata3FJS(conLikeArea);
                return objects;
            } else {
                List<Object> objects = getdata3(conLikeArea);
                return objects;
            }
        } else {
            return null;
        }
    }


    public List<Object> getdata4(String area) {
        //retype
        int cpkf = 0;//产品开发
        int jsgg = 0;//技术攻关
        int gygj = 0;//工艺改进
        int cgzh = 0;//成果转化
        int qygl = 0;//企业管理
        int bzjs = 0;//班组建设
        int rcpy = 0;//人才培养
        int jnpx = 0;//技能培训
        int gyjz = 0;//公益讲座
        int qt = 0;//其他

        String cpkf_str = "%产品开发%";
        String jsgg_str = "%技术攻关%";
        String gygj_str = "%工艺改进%";
        String cgzh_str = "%成果转化%";
        String qygl_str = "%企业管理%";
        String bzjs_str = "%班组建设%";
        String rcpy_str = "%人才培养%";
        String jnpx_str = "%技能培训%";
        String gyjz_str = "%公益讲座%";
        String qt_str = "%其他%";

        List<SciTechnologyDemand> cpkflist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShow(cpkf_str, shtg, area);
        if (cpkflist != null) {
            cpkf = cpkflist.size();
        }

        List<SciTechnologyDemand> jsgglist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShow(jsgg_str, shtg, area);
        if (jsgglist != null) {
            jsgg = jsgglist.size();
        }

        List<SciTechnologyDemand> gygjlist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShow(gygj_str, shtg, area);
        if (gygjlist != null) {
            gygj = gygjlist.size();
        }

        List<SciTechnologyDemand> cgzhlist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShow(cgzh_str, shtg, area);
        if (cgzhlist != null) {
            cgzh = cgzhlist.size();
        }

        List<SciTechnologyDemand> qygllist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShow(qygl_str, shtg, area);
        if (qygllist != null) {
            qygl = qygllist.size();
        }

        List<SciTechnologyDemand> bzjslist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShow(bzjs_str, shtg, area);
        if (bzjslist != null) {
            bzjs = bzjslist.size();
        }

        List<SciTechnologyDemand> rcpylist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShow(rcpy_str, shtg, area);
        if (rcpylist != null) {
            rcpy = rcpylist.size();
        }

        List<SciTechnologyDemand> jnpxlist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShow(jnpx_str, shtg, area);
        if (jnpxlist != null) {
            jnpx = jnpxlist.size();
        }

        List<SciTechnologyDemand> gyjzlist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShow(gyjz_str, shtg, area);
        if (gyjzlist != null) {
            gyjz = gyjzlist.size();
        }

        List<SciTechnologyDemand> qtlist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShow(qt_str, shtg, area);
        if (qtlist != null) {
            qt = qtlist.size();
        }


        int a1 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowCSeven(cpkf_str, shtg, getSevenDateBefore(), area);
        int a2 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowDSeven(cpkf_str, shtg, getSevenDateBefore(), area);

        int a3 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowCSeven(jsgg_str, shtg, getSevenDateBefore(), area);
        int a4 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowDSeven(jsgg_str, shtg, getSevenDateBefore(), area);

        int a5 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowCSeven(gygj_str, shtg, getSevenDateBefore(), area);
        int a6 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowDSeven(gygj_str, shtg, getSevenDateBefore(), area);

        int a7 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowCSeven(cgzh_str, shtg, getSevenDateBefore(), area);
        int a8 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowDSeven(cgzh_str, shtg, getSevenDateBefore(), area);

        int a9 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowCSeven(qygl_str, shtg, getSevenDateBefore(), area);
        int a10 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowDSeven(qygl_str, shtg, getSevenDateBefore(), area);

        int a11 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowCSeven(bzjs_str, shtg, getSevenDateBefore(), area);
        int a12 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowDSeven(bzjs_str, shtg, getSevenDateBefore(), area);

        int a13 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowCSeven(rcpy_str, shtg, getSevenDateBefore(), area);
        int a14 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowDSeven(rcpy_str, shtg, getSevenDateBefore(), area);

        int a15 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowCSeven(jnpx_str, shtg, getSevenDateBefore(), area);
        int a16 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowDSeven(jnpx_str, shtg, getSevenDateBefore(), area);

        int a17 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowCSeven(gyjz_str, shtg, getSevenDateBefore(), area);
        int a18 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowDSeven(gyjz_str, shtg, getSevenDateBefore(), area);

        int a19 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowCSeven(qt_str, shtg, getSevenDateBefore(), area);
        int a20 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowDSeven(qt_str, shtg, getSevenDateBefore(), area);

        List<Object> list = new ArrayList<Object>();

        LinkedHashMap<String, Object> jsonMap1 = new LinkedHashMap<String, Object>();
        jsonMap1.put("name", "产品开发");
        jsonMap1.put("value", cpkf);
        jsonMap1.put("value2", a1 - a2);
        list.add(jsonMap1);

        LinkedHashMap<String, Object> jsonMap2 = new LinkedHashMap<String, Object>();
        jsonMap2.put("name", "技术攻关");
        jsonMap2.put("value", jsgg);
        jsonMap2.put("value2", a3 - a4);
        list.add(jsonMap2);

        LinkedHashMap<String, Object> jsonMap3 = new LinkedHashMap<String, Object>();
        jsonMap3.put("name", "工艺改进");
        jsonMap3.put("value", gygj);
        jsonMap3.put("value2", a5 - a6);
        list.add(jsonMap3);

        LinkedHashMap<String, Object> jsonMap4 = new LinkedHashMap<String, Object>();
        jsonMap4.put("name", "成果转化");
        jsonMap4.put("value", cgzh);
        jsonMap4.put("value2", a7 - a8);
        list.add(jsonMap4);

        LinkedHashMap<String, Object> jsonMap5 = new LinkedHashMap<String, Object>();
        jsonMap5.put("name", "企业管理");
        jsonMap5.put("value", qygl);
        jsonMap5.put("value2", a9 - a10);
        list.add(jsonMap5);

        LinkedHashMap<String, Object> jsonMap6 = new LinkedHashMap<String, Object>();
        jsonMap6.put("name", "班组建设");
        jsonMap6.put("value", bzjs);
        jsonMap6.put("value2", a11 - a12);
        list.add(jsonMap6);

        LinkedHashMap<String, Object> jsonMap7 = new LinkedHashMap<String, Object>();
        jsonMap7.put("name", "人才培养");
        jsonMap7.put("value", rcpy);
        jsonMap7.put("value2", a13 - a14);
        list.add(jsonMap7);

        LinkedHashMap<String, Object> jsonMap8 = new LinkedHashMap<String, Object>();
        jsonMap8.put("name", "技能培训");
        jsonMap8.put("value", jnpx);
        jsonMap8.put("value2", a15 - a16);
        list.add(jsonMap8);

        LinkedHashMap<String, Object> jsonMap9 = new LinkedHashMap<String, Object>();
        jsonMap9.put("name", "公益讲座");
        jsonMap9.put("value", gyjz);
        jsonMap9.put("value2", a17 - a18);
        list.add(jsonMap9);

        LinkedHashMap<String, Object> jsonMap10 = new LinkedHashMap<String, Object>();
        jsonMap10.put("name", "其他");
        jsonMap10.put("value", qt);
        jsonMap10.put("value2", a19 - a20);
        list.add(jsonMap10);

        return list;
    }

    public List<Object> getdata4FJS(String area) {
        //retype
        int cpkf = 0;//产品开发
        int jsgg = 0;//技术攻关
        int gygj = 0;//工艺改进
        int cgzh = 0;//成果转化
        int qygl = 0;//企业管理
        int bzjs = 0;//班组建设
        int rcpy = 0;//人才培养
        int jnpx = 0;//技能培训
        int gyjz = 0;//公益讲座
        int qt = 0;//其他

        String cpkf_str = "%产品开发%";
        String jsgg_str = "%技术攻关%";
        String gygj_str = "%工艺改进%";
        String cgzh_str = "%成果转化%";
        String qygl_str = "%企业管理%";
        String bzjs_str = "%班组建设%";
        String rcpy_str = "%人才培养%";
        String jnpx_str = "%技能培训%";
        String gyjz_str = "%公益讲座%";
        String qt_str = "%其他%";

        List<SciTechnologyDemand> cpkflist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJS(cpkf_str, shtg);
        if (cpkflist != null) {
            cpkf = cpkflist.size();
        }

        List<SciTechnologyDemand> jsgglist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJS(jsgg_str, shtg);
        if (jsgglist != null) {
            jsgg = jsgglist.size();
        }

        List<SciTechnologyDemand> gygjlist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJS(gygj_str, shtg);
        if (gygjlist != null) {
            gygj = gygjlist.size();
        }

        List<SciTechnologyDemand> cgzhlist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJS(cgzh_str, shtg);
        if (cgzhlist != null) {
            cgzh = cgzhlist.size();
        }

        List<SciTechnologyDemand> qygllist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJS(qygl_str, shtg);
        if (qygllist != null) {
            qygl = qygllist.size();
        }

        List<SciTechnologyDemand> bzjslist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJS(bzjs_str, shtg);
        if (bzjslist != null) {
            bzjs = bzjslist.size();
        }

        List<SciTechnologyDemand> rcpylist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJS(rcpy_str, shtg);
        if (rcpylist != null) {
            rcpy = rcpylist.size();
        }

        List<SciTechnologyDemand> jnpxlist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJS(jnpx_str, shtg);
        if (jnpxlist != null) {
            jnpx = jnpxlist.size();
        }

        List<SciTechnologyDemand> gyjzlist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJS(gyjz_str, shtg);
        if (gyjzlist != null) {
            gyjz = gyjzlist.size();
        }

        List<SciTechnologyDemand> qtlist = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJS(qt_str, shtg);
        if (qtlist != null) {
            qt = qtlist.size();
        }


        int a1 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(cpkf_str, shtg, getSevenDateBefore());
        int a2 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(cpkf_str, shtg, getSevenDateBefore());

        int a3 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(jsgg_str, shtg, getSevenDateBefore());
        int a4 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(jsgg_str, shtg, getSevenDateBefore());

        int a5 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(gygj_str, shtg, getSevenDateBefore());
        int a6 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(gygj_str, shtg, getSevenDateBefore());

        int a7 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(cgzh_str, shtg, getSevenDateBefore());
        int a8 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(cgzh_str, shtg, getSevenDateBefore());

        int a9 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(qygl_str, shtg, getSevenDateBefore());
        int a10 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(qygl_str, shtg, getSevenDateBefore());

        int a11 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(bzjs_str, shtg, getSevenDateBefore());
        int a12 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(bzjs_str, shtg, getSevenDateBefore());

        int a13 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(rcpy_str, shtg, getSevenDateBefore());
        int a14 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(rcpy_str, shtg, getSevenDateBefore());

        int a15 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(jnpx_str, shtg, getSevenDateBefore());
        int a16 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(jnpx_str, shtg, getSevenDateBefore());

        int a17 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(gyjz_str, shtg, getSevenDateBefore());
        int a18 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(gyjz_str, shtg, getSevenDateBefore());

        int a19 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(qt_str, shtg, getSevenDateBefore());
        int a20 = sciTechnologyDemandRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(qt_str, shtg, getSevenDateBefore());


        List<Object> list = new ArrayList<Object>();

        LinkedHashMap<String, Object> jsonMap1 = new LinkedHashMap<String, Object>();
        jsonMap1.put("name", "产品开发");
        jsonMap1.put("value", cpkf);
        jsonMap1.put("value2", a1 - a2);
        list.add(jsonMap1);

        LinkedHashMap<String, Object> jsonMap2 = new LinkedHashMap<String, Object>();
        jsonMap2.put("name", "技术攻关");
        jsonMap2.put("value", jsgg);
        jsonMap2.put("value2", a3 - a4);
        list.add(jsonMap2);

        LinkedHashMap<String, Object> jsonMap3 = new LinkedHashMap<String, Object>();
        jsonMap3.put("name", "工艺改进");
        jsonMap3.put("value", gygj);
        jsonMap3.put("value2", a5 - a6);
        list.add(jsonMap3);

        LinkedHashMap<String, Object> jsonMap4 = new LinkedHashMap<String, Object>();
        jsonMap4.put("name", "成果转化");
        jsonMap4.put("value", cgzh);
        jsonMap4.put("value2", a7 - a8);
        list.add(jsonMap4);

        LinkedHashMap<String, Object> jsonMap5 = new LinkedHashMap<String, Object>();
        jsonMap5.put("name", "企业管理");
        jsonMap5.put("value", qygl);
        jsonMap5.put("value2", a9 - a10);
        list.add(jsonMap5);

        LinkedHashMap<String, Object> jsonMap6 = new LinkedHashMap<String, Object>();
        jsonMap6.put("name", "班组建设");
        jsonMap6.put("value", bzjs);
        jsonMap6.put("value2", a11 - a12);
        list.add(jsonMap6);

        LinkedHashMap<String, Object> jsonMap7 = new LinkedHashMap<String, Object>();
        jsonMap7.put("name", "人才培养");
        jsonMap7.put("value", rcpy);
        jsonMap7.put("value2", a13 - a14);
        list.add(jsonMap7);

        LinkedHashMap<String, Object> jsonMap8 = new LinkedHashMap<String, Object>();
        jsonMap8.put("name", "技能培训");
        jsonMap8.put("value", jnpx);
        jsonMap8.put("value2", a15 - a16);
        list.add(jsonMap8);

        LinkedHashMap<String, Object> jsonMap9 = new LinkedHashMap<String, Object>();
        jsonMap9.put("name", "公益讲座");
        jsonMap9.put("value", gyjz);
        jsonMap9.put("value2", a17 - a18);
        list.add(jsonMap9);

        LinkedHashMap<String, Object> jsonMap10 = new LinkedHashMap<String, Object>();
        jsonMap10.put("name", "其他");
        jsonMap10.put("value", qt);
        jsonMap10.put("value2", a19 - a20);
        list.add(jsonMap10);

        return list;
    }


    public List<Object> getDemndsAllTypes() {
        String loginArea = getLoginArea();
        if (loginArea != null && !loginArea.equals("")) {
            String conLikeArea = conLikeArea(loginArea);
            if (conLikeArea != null && conLikeArea.contains(FJSCITY)) {
                List<Object> objects = getdata4FJS(conLikeArea);
                return objects;
            } else {
                List<Object> objects = getdata4(conLikeArea);
                return objects;
            }
        } else {
            return null;
        }
    }


    public List<Object> getdata5(String area) {
        //retype
        int cpkf = 0;//产品开发
        int jsgg = 0;//技术攻关
        int gygj = 0;//工艺改进
        int cgzh = 0;//成果转化
        int qygl = 0;//企业管理
        int bzjs = 0;//班组建设
        int rcpy = 0;//人才培养
        int jnpx = 0;//技能培训
        int gyjz = 0;//公益讲座
        int qt = 0;//其他

        String cpkf_str = "%产品开发%";
        String jsgg_str = "%技术攻关%";
        String gygj_str = "%工艺改进%";
        String cgzh_str = "%成果转化%";
        String qygl_str = "%企业管理%";
        String bzjs_str = "%班组建设%";
        String rcpy_str = "%人才培养%";
        String jnpx_str = "%技能培训%";
        String gyjz_str = "%公益讲座%";
        String qt_str = "%其他%";

        List<SciPersonnelInfo> cpkflist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShow(cpkf_str, shtg, area);
        if (cpkflist != null) {
            cpkf = cpkflist.size();
        }

        List<SciPersonnelInfo> jsgglist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShow(jsgg_str, shtg, area);
        if (jsgglist != null) {
            jsgg = jsgglist.size();
        }

        List<SciPersonnelInfo> gygjlist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShow(gygj_str, shtg, area);
        if (gygjlist != null) {
            gygj = gygjlist.size();
        }

        List<SciPersonnelInfo> cgzhlist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShow(cgzh_str, shtg, area);
        if (cgzhlist != null) {
            cgzh = cgzhlist.size();
        }

        List<SciPersonnelInfo> qygllist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShow(qygl_str, shtg, area);
        if (qygllist != null) {
            qygl = qygllist.size();
        }

        List<SciPersonnelInfo> bzjslist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShow(bzjs_str, shtg, area);
        if (bzjslist != null) {
            bzjs = bzjslist.size();
        }

        List<SciPersonnelInfo> rcpylist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShow(rcpy_str, shtg, area);
        if (rcpylist != null) {
            rcpy = rcpylist.size();
        }

        List<SciPersonnelInfo> jnpxlist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShow(jnpx_str, shtg, area);
        if (jnpxlist != null) {
            jnpx = jnpxlist.size();
        }

        List<SciPersonnelInfo> gyjzlist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShow(gyjz_str, shtg, area);
        if (gyjzlist != null) {
            gyjz = gyjzlist.size();
        }

        List<SciPersonnelInfo> qtlist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShow(qt_str, shtg, area);
        if (qtlist != null) {
            qt = qtlist.size();
        }

        int a1 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowCSeven(cpkf_str, shtg, getSevenDateBefore(), area);
        int a2 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowDSeven(cpkf_str, shtg, getSevenDateBefore(), area);

        int a3 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowCSeven(jsgg_str, shtg, getSevenDateBefore(), area);
        int a4 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowDSeven(jsgg_str, shtg, getSevenDateBefore(), area);

        int a5 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowCSeven(gygj_str, shtg, getSevenDateBefore(), area);
        int a6 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowDSeven(gygj_str, shtg, getSevenDateBefore(), area);

        int a7 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowCSeven(cgzh_str, shtg, getSevenDateBefore(), area);
        int a8 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowDSeven(cgzh_str, shtg, getSevenDateBefore(), area);

        int a9 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowCSeven(qygl_str, shtg, getSevenDateBefore(), area);
        int a10 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowDSeven(qygl_str, shtg, getSevenDateBefore(), area);

        int a11 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowCSeven(bzjs_str, shtg, getSevenDateBefore(), area);
        int a12 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowDSeven(bzjs_str, shtg, getSevenDateBefore(), area);

        int a13 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowCSeven(rcpy_str, shtg, getSevenDateBefore(), area);
        int a14 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowDSeven(rcpy_str, shtg, getSevenDateBefore(), area);

        int a15 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowCSeven(jnpx_str, shtg, getSevenDateBefore(), area);
        int a16 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowDSeven(jnpx_str, shtg, getSevenDateBefore(), area);

        int a17 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowCSeven(gyjz_str, shtg, getSevenDateBefore(), area);
        int a18 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowDSeven(gyjz_str, shtg, getSevenDateBefore(), area);

        int a19 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowCSeven(qt_str, shtg, getSevenDateBefore(), area);
        int a20 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowDSeven(qt_str, shtg, getSevenDateBefore(), area);

        List<Object> list = new ArrayList<Object>();

        LinkedHashMap<String, Object> jsonMap1 = new LinkedHashMap<String, Object>();
        jsonMap1.put("name", "产品开发");
        jsonMap1.put("value", cpkf);
        jsonMap1.put("value2", a1 - a2);
        list.add(jsonMap1);

        LinkedHashMap<String, Object> jsonMap2 = new LinkedHashMap<String, Object>();
        jsonMap2.put("name", "技术攻关");
        jsonMap2.put("value", jsgg);
        jsonMap2.put("value2", a3 - a4);
        list.add(jsonMap2);

        LinkedHashMap<String, Object> jsonMap3 = new LinkedHashMap<String, Object>();
        jsonMap3.put("name", "工艺改进");
        jsonMap3.put("value", gygj);
        jsonMap3.put("value2", a5 - a6);
        list.add(jsonMap3);

        LinkedHashMap<String, Object> jsonMap4 = new LinkedHashMap<String, Object>();
        jsonMap4.put("name", "成果转化");
        jsonMap4.put("value", cgzh);
        jsonMap4.put("value2", a7 - a8);
        list.add(jsonMap4);

        LinkedHashMap<String, Object> jsonMap5 = new LinkedHashMap<String, Object>();
        jsonMap5.put("name", "企业管理");
        jsonMap5.put("value", qygl);
        jsonMap5.put("value2", a9 - a10);
        list.add(jsonMap5);

        LinkedHashMap<String, Object> jsonMap6 = new LinkedHashMap<String, Object>();
        jsonMap6.put("name", "班组建设");
        jsonMap6.put("value", bzjs);
        jsonMap6.put("value2", a11 - a12);
        list.add(jsonMap6);

        LinkedHashMap<String, Object> jsonMap7 = new LinkedHashMap<String, Object>();
        jsonMap7.put("name", "人才培养");
        jsonMap7.put("value", rcpy);
        jsonMap7.put("value2", a13 - a14);
        list.add(jsonMap7);

        LinkedHashMap<String, Object> jsonMap8 = new LinkedHashMap<String, Object>();
        jsonMap8.put("name", "技能培训");
        jsonMap8.put("value", jnpx);
        jsonMap8.put("value2", a15 - a16);
        list.add(jsonMap8);

        LinkedHashMap<String, Object> jsonMap9 = new LinkedHashMap<String, Object>();
        jsonMap9.put("name", "公益讲座");
        jsonMap9.put("value", gyjz);
        jsonMap9.put("value2", a17 - a18);
        list.add(jsonMap9);

        LinkedHashMap<String, Object> jsonMap10 = new LinkedHashMap<String, Object>();
        jsonMap10.put("name", "其他");
        jsonMap10.put("value", qt);
        jsonMap10.put("value2", a19 - a20);
        list.add(jsonMap10);

        return list;
    }

    public List<Object> getdata5FJS(String area) {
        //retype
        int cpkf = 0;//产品开发
        int jsgg = 0;//技术攻关
        int gygj = 0;//工艺改进
        int cgzh = 0;//成果转化
        int qygl = 0;//企业管理
        int bzjs = 0;//班组建设
        int rcpy = 0;//人才培养
        int jnpx = 0;//技能培训
        int gyjz = 0;//公益讲座
        int qt = 0;//其他

        String cpkf_str = "%产品开发%";
        String jsgg_str = "%技术攻关%";
        String gygj_str = "%工艺改进%";
        String cgzh_str = "%成果转化%";
        String qygl_str = "%企业管理%";
        String bzjs_str = "%班组建设%";
        String rcpy_str = "%人才培养%";
        String jnpx_str = "%技能培训%";
        String gyjz_str = "%公益讲座%";
        String qt_str = "%其他%";

        List<SciPersonnelInfo> cpkflist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJS(cpkf_str, shtg);
        if (cpkflist != null) {
            cpkf = cpkflist.size();
        }

        List<SciPersonnelInfo> jsgglist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJS(jsgg_str, shtg);
        if (jsgglist != null) {
            jsgg = jsgglist.size();
        }

        List<SciPersonnelInfo> gygjlist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJS(gygj_str, shtg);
        if (gygjlist != null) {
            gygj = gygjlist.size();
        }

        List<SciPersonnelInfo> cgzhlist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJS(cgzh_str, shtg);
        if (cgzhlist != null) {
            cgzh = cgzhlist.size();
        }

        List<SciPersonnelInfo> qygllist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJS(qygl_str, shtg);
        if (qygllist != null) {
            qygl = qygllist.size();
        }

        List<SciPersonnelInfo> bzjslist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJS(bzjs_str, shtg);
        if (bzjslist != null) {
            bzjs = bzjslist.size();
        }

        List<SciPersonnelInfo> rcpylist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJS(rcpy_str, shtg);
        if (rcpylist != null) {
            rcpy = rcpylist.size();
        }

        List<SciPersonnelInfo> jnpxlist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJS(jnpx_str, shtg);
        if (jnpxlist != null) {
            jnpx = jnpxlist.size();
        }

        List<SciPersonnelInfo> gyjzlist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJS(gyjz_str, shtg);
        if (gyjzlist != null) {
            gyjz = gyjzlist.size();
        }

        List<SciPersonnelInfo> qtlist = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJS(qt_str, shtg);
        if (qtlist != null) {
            qt = qtlist.size();
        }


        int a1 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(cpkf_str, shtg, getSevenDateBefore());
        int a2 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(cpkf_str, shtg, getSevenDateBefore());

        int a3 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(jsgg_str, shtg, getSevenDateBefore());
        int a4 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(jsgg_str, shtg, getSevenDateBefore());

        int a5 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(gygj_str, shtg, getSevenDateBefore());
        int a6 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(gygj_str, shtg, getSevenDateBefore());

        int a7 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(cgzh_str, shtg, getSevenDateBefore());
        int a8 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(cgzh_str, shtg, getSevenDateBefore());

        int a9 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(qygl_str, shtg, getSevenDateBefore());
        int a10 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(qygl_str, shtg, getSevenDateBefore());

        int a11 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(bzjs_str, shtg, getSevenDateBefore());
        int a12 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(bzjs_str, shtg, getSevenDateBefore());

        int a13 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(rcpy_str, shtg, getSevenDateBefore());
        int a14 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(rcpy_str, shtg, getSevenDateBefore());

        int a15 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(jnpx_str, shtg, getSevenDateBefore());
        int a16 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(jnpx_str, shtg, getSevenDateBefore());

        int a17 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(gyjz_str, shtg, getSevenDateBefore());
        int a18 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(gyjz_str, shtg, getSevenDateBefore());

        int a19 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSCSeven(qt_str, shtg, getSevenDateBefore());
        int a20 = sciPersonnelInfoRepository.findNormalByLikeReTypeWithOutIsShowFJSDSeven(qt_str, shtg, getSevenDateBefore());

        List<Object> list = new ArrayList<Object>();

        LinkedHashMap<String, Object> jsonMap1 = new LinkedHashMap<String, Object>();
        jsonMap1.put("name", "产品开发");
        jsonMap1.put("value", cpkf);
        jsonMap1.put("value2", a1 - a2);
        list.add(jsonMap1);

        LinkedHashMap<String, Object> jsonMap2 = new LinkedHashMap<String, Object>();
        jsonMap2.put("name", "技术攻关");
        jsonMap2.put("value", jsgg);
        jsonMap2.put("value2", a3 - a4);
        list.add(jsonMap2);

        LinkedHashMap<String, Object> jsonMap3 = new LinkedHashMap<String, Object>();
        jsonMap3.put("name", "工艺改进");
        jsonMap3.put("value", gygj);
        jsonMap3.put("value2", a5 - a6);
        list.add(jsonMap3);

        LinkedHashMap<String, Object> jsonMap4 = new LinkedHashMap<String, Object>();
        jsonMap4.put("name", "成果转化");
        jsonMap4.put("value", cgzh);
        jsonMap4.put("value2", a7 - a8);
        list.add(jsonMap4);

        LinkedHashMap<String, Object> jsonMap5 = new LinkedHashMap<String, Object>();
        jsonMap5.put("name", "企业管理");
        jsonMap5.put("value", qygl);
        jsonMap5.put("value2", a9 - a10);
        list.add(jsonMap5);

        LinkedHashMap<String, Object> jsonMap6 = new LinkedHashMap<String, Object>();
        jsonMap6.put("name", "班组建设");
        jsonMap6.put("value", bzjs);
        jsonMap6.put("value2", a11 - a12);
        list.add(jsonMap6);

        LinkedHashMap<String, Object> jsonMap7 = new LinkedHashMap<String, Object>();
        jsonMap7.put("name", "人才培养");
        jsonMap7.put("value", rcpy);
        jsonMap7.put("value2", a13 - a14);
        list.add(jsonMap7);

        LinkedHashMap<String, Object> jsonMap8 = new LinkedHashMap<String, Object>();
        jsonMap8.put("name", "技能培训");
        jsonMap8.put("value", jnpx);
        jsonMap8.put("value2", a15 - a16);
        list.add(jsonMap8);

        LinkedHashMap<String, Object> jsonMap9 = new LinkedHashMap<String, Object>();
        jsonMap9.put("name", "公益讲座");
        jsonMap9.put("value", gyjz);
        jsonMap9.put("value2", a17 - a18);
        list.add(jsonMap9);

        LinkedHashMap<String, Object> jsonMap10 = new LinkedHashMap<String, Object>();
        jsonMap10.put("name", "其他");
        jsonMap10.put("value", qt);
        jsonMap10.put("value2", a19 - a20);
        list.add(jsonMap10);

        return list;
    }

    public List<Object> getModelsAllTypes() {
        String loginArea = getLoginArea();
        if (loginArea != null && !loginArea.equals("")) {
            String conLikeArea = conLikeArea(loginArea);
            if (conLikeArea != null && conLikeArea.contains(FJSCITY)) {
                List<Object> objects = getdata5FJS(conLikeArea);
                return objects;
            } else {
                List<Object> objects = getdata5(conLikeArea);
                return objects;
            }
        } else {
            return null;
        }
    }


    public List<Object> getdata6(String area) {
        int qbcount = 0;
        int ppzcount = 0;
        int yppcount = 0;
        int yjjcount = 0;

        List<SciTechnologyDemand> ppzlist = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShow(ppz, shtg, area);
        if (ppzlist != null) {
            ppzcount = ppzlist.size();
        }

        List<SciTechnologyDemand> ypplist = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShow(ypp, shtg, area);
        if (ypplist != null) {
            yppcount = ypplist.size();
        }

        List<SciTechnologyDemand> yjjlist = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShow(yjj, shtg, area);
        if (yjjlist != null) {
            yjjcount = yjjlist.size();
        }

        qbcount = ppzcount + yppcount + yjjcount;

        int a1 = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowCSeven(ppz, shtg, area, getSevenDateBefore());
        int a2 = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowDSeven(ppz, shtg, area, getSevenDateBefore());

        int a3 = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowCSeven(ypp, shtg, area, getSevenDateBefore());
        int a4 = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowDSeven(ypp, shtg, area, getSevenDateBefore());

        int a5 = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowCSeven(yjj, shtg, area, getSevenDateBefore());
        int a6 = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowDSeven(yjj, shtg, area, getSevenDateBefore());
        List<Object> list = new ArrayList<Object>();

        LinkedHashMap<String, Object> jsonMap1 = new LinkedHashMap<String, Object>();
        jsonMap1.put("name", "全部");
        jsonMap1.put("value", qbcount);
        jsonMap1.put("value2", (a1 - a2) + (a3 - a4) + (a5 - a6));
        list.add(jsonMap1);

        LinkedHashMap<String, Object> jsonMap2 = new LinkedHashMap<String, Object>();
        jsonMap2.put("name", "匹配中");
        jsonMap2.put("value", ppzcount);
        jsonMap2.put("value2", a1 - a2);
        list.add(jsonMap2);

        LinkedHashMap<String, Object> jsonMap3 = new LinkedHashMap<String, Object>();
        jsonMap3.put("name", "已匹配");
        jsonMap3.put("value", yppcount);
        jsonMap3.put("value2", a3 - a4);
        list.add(jsonMap3);

        LinkedHashMap<String, Object> jsonMap4 = new LinkedHashMap<String, Object>();
        jsonMap4.put("name", "已解决");
        jsonMap4.put("value", yjjcount);
        jsonMap4.put("value2", a5 - a6);
        list.add(jsonMap4);
        return list;
    }

    public List<Object> getdata6FJS(String area) {
        int qbcount = 0;
        int ppzcount = 0;
        int yppcount = 0;
        int yjjcount = 0;

        List<SciTechnologyDemand> ppzlist = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowFJS(ppz, shtg);
        if (ppzlist != null) {
            ppzcount = ppzlist.size();
        }

        List<SciTechnologyDemand> ypplist = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowFJS(ypp, shtg);
        if (ypplist != null) {
            yppcount = ypplist.size();
        }

        List<SciTechnologyDemand> yjjlist = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowFJS(yjj, shtg);
        if (yjjlist != null) {
            yjjcount = yjjlist.size();
        }


        qbcount = ppzcount + yppcount + yjjcount;


        int a1 = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowFJSCSeven(ppz, shtg, getSevenDateBefore());
        int a2 = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowFJSDSeven(ppz, shtg, getSevenDateBefore());

        int a3 = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowFJSCSeven(ypp, shtg, getSevenDateBefore());
        int a4 = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowFJSDSeven(ypp, shtg, getSevenDateBefore());

        int a5 = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowFJSCSeven(yjj, shtg, getSevenDateBefore());
        int a6 = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShowFJSDSeven(yjj, shtg, getSevenDateBefore());

        List<Object> list = new ArrayList<Object>();

        LinkedHashMap<String, Object> jsonMap1 = new LinkedHashMap<String, Object>();
        jsonMap1.put("name", "全部");
        jsonMap1.put("value", qbcount);
        jsonMap1.put("value2", (a1 - a2) + (a3 - a4) + (a5 - a6));
        list.add(jsonMap1);

        LinkedHashMap<String, Object> jsonMap2 = new LinkedHashMap<String, Object>();
        jsonMap2.put("name", "匹配中");
        jsonMap2.put("value", ppzcount);
        jsonMap2.put("value2", a1 - a2);
        list.add(jsonMap2);

        LinkedHashMap<String, Object> jsonMap3 = new LinkedHashMap<String, Object>();
        jsonMap3.put("name", "已匹配");
        jsonMap3.put("value", yppcount);
        jsonMap3.put("value2", a3 - a4);
        list.add(jsonMap3);

        LinkedHashMap<String, Object> jsonMap4 = new LinkedHashMap<String, Object>();
        jsonMap4.put("name", "已解决");
        jsonMap4.put("value", yjjcount);
        jsonMap4.put("value2", a5 - a6);
        list.add(jsonMap4);
        return list;
    }

    public List<Object> getDemandsDostatusCounts() {
        String loginArea = getLoginArea();
        if (loginArea != null && !loginArea.equals("")) {
            String conLikeArea = conLikeArea(loginArea);
            if (conLikeArea != null && conLikeArea.contains(FJSCITY)) {
                List<Object> objects = getdata6FJS(conLikeArea);
                return objects;
            } else {
                List<Object> objects = getdata6(conLikeArea);
                return objects;
            }
        } else {
            return null;
        }
    }


    public List<SciTechnologyDemandDto> getdata7(Integer type, String area) {
        if (type == null) {
            throw new BadRequestException("请输入对应的类型");
        }
        if (type != 1 && type != 2 && type != 3 && type != 4) {
            throw new BadRequestException("请输入正确的类型");
        }
        if (type == 1) {
            List<SciTechnologyDemand> list = sciTechnologyDemandRepository.findNormalTop(shtg, area);
            List<SciTechnologyDemandDto> sciTechnologyDemandDtos = sciTechnologyDemandMapper.toDto(list);
            if (sciTechnologyDemandDtos != null) {
                for (SciTechnologyDemandDto dto : sciTechnologyDemandDtos) {
                    String orgArea = dto.getOrgArea();
                    if (orgArea != null && orgArea.contains(";")) {
                        String[] array = orgArea.split(";");
                        dto.setOrgAreas(array);
                    } else {
                        String[] array = {};
                        dto.setOrgAreas(array);
                    }
                }
            }
            return sciTechnologyDemandDtos;
        } else if (type == 2) {
            List<SciTechnologyDemand> list = sciTechnologyDemandRepository.findNormalTopWithDoStatus(ppz, shtg, area);
            List<SciTechnologyDemandDto> sciTechnologyDemandDtos = sciTechnologyDemandMapper.toDto(list);
            if (sciTechnologyDemandDtos != null) {
                for (SciTechnologyDemandDto dto : sciTechnologyDemandDtos) {
                    String orgArea = dto.getOrgArea();
                    if (orgArea != null && orgArea.contains(";")) {
                        String[] array = orgArea.split(";");
                        dto.setOrgAreas(array);
                    } else {
                        String[] array = {};
                        dto.setOrgAreas(array);
                    }
                }
            }
            return sciTechnologyDemandDtos;
        } else if (type == 3) {
            List<SciTechnologyDemand> list = sciTechnologyDemandRepository.findNormalTopWithDoStatus(ypp, shtg, area);
            List<SciTechnologyDemandDto> sciTechnologyDemandDtos = sciTechnologyDemandMapper.toDto(list);
            if (sciTechnologyDemandDtos != null) {
                for (SciTechnologyDemandDto dto : sciTechnologyDemandDtos) {
                    String orgArea = dto.getOrgArea();
                    if (orgArea != null && orgArea.contains(";")) {
                        String[] array = orgArea.split(";");
                        dto.setOrgAreas(array);
                    } else {
                        String[] array = {};
                        dto.setOrgAreas(array);
                    }
                }
            }
            return sciTechnologyDemandDtos;
        } else if (type == 4) {
            List<SciTechnologyDemand> list = sciTechnologyDemandRepository.findNormalTopWithDoStatus(yjj, shtg, area);
            List<SciTechnologyDemandDto> sciTechnologyDemandDtos = sciTechnologyDemandMapper.toDto(list);
            if (sciTechnologyDemandDtos != null) {
                for (SciTechnologyDemandDto dto : sciTechnologyDemandDtos) {
                    String orgArea = dto.getOrgArea();
                    if (orgArea != null && orgArea.contains(";")) {
                        String[] array = orgArea.split(";");
                        dto.setOrgAreas(array);
                    } else {
                        String[] array = {};
                        dto.setOrgAreas(array);
                    }
                }
            }
            return sciTechnologyDemandDtos;
        } else {
            throw new BadRequestException("请输入正确的类型");
        }
    }

    public List<SciTechnologyDemandDto> getdata7FJS(Integer type, String area) {
        if (type == null) {
            throw new BadRequestException("请输入对应的类型");
        }
        if (type != 1 && type != 2 && type != 3 && type != 4) {
            throw new BadRequestException("请输入正确的类型");
        }
        if (type == 1) {
            List<SciTechnologyDemand> list = sciTechnologyDemandRepository.findNormalTopFJS(shtg);
            List<SciTechnologyDemandDto> sciTechnologyDemandDtos = sciTechnologyDemandMapper.toDto(list);
            if (sciTechnologyDemandDtos != null) {
                for (SciTechnologyDemandDto dto : sciTechnologyDemandDtos) {
                    String orgArea = dto.getOrgArea();
                    if (orgArea != null && orgArea.contains(";")) {
                        String[] array = orgArea.split(";");
                        dto.setOrgAreas(array);
                    } else {
                        String[] array = {};
                        dto.setOrgAreas(array);
                    }
                }
            }
            return sciTechnologyDemandDtos;
        } else if (type == 2) {
            List<SciTechnologyDemand> list = sciTechnologyDemandRepository.findNormalTopWithDoStatusFJS(ppz, shtg);
            List<SciTechnologyDemandDto> sciTechnologyDemandDtos = sciTechnologyDemandMapper.toDto(list);
            if (sciTechnologyDemandDtos != null) {
                for (SciTechnologyDemandDto dto : sciTechnologyDemandDtos) {
                    String orgArea = dto.getOrgArea();
                    if (orgArea != null && orgArea.contains(";")) {
                        String[] array = orgArea.split(";");
                        dto.setOrgAreas(array);
                    } else {
                        String[] array = {};
                        dto.setOrgAreas(array);
                    }
                }
            }
            return sciTechnologyDemandDtos;
        } else if (type == 3) {
            List<SciTechnologyDemand> list = sciTechnologyDemandRepository.findNormalTopWithDoStatusFJS(ypp, shtg);
            List<SciTechnologyDemandDto> sciTechnologyDemandDtos = sciTechnologyDemandMapper.toDto(list);
            if (sciTechnologyDemandDtos != null) {
                for (SciTechnologyDemandDto dto : sciTechnologyDemandDtos) {
                    String orgArea = dto.getOrgArea();
                    if (orgArea != null && orgArea.contains(";")) {
                        String[] array = orgArea.split(";");
                        dto.setOrgAreas(array);
                    } else {
                        String[] array = {};
                        dto.setOrgAreas(array);
                    }
                }
            }
            return sciTechnologyDemandDtos;
        } else if (type == 4) {
            List<SciTechnologyDemand> list = sciTechnologyDemandRepository.findNormalTopWithDoStatusFJS(yjj, shtg);
            List<SciTechnologyDemandDto> sciTechnologyDemandDtos = sciTechnologyDemandMapper.toDto(list);
            if (sciTechnologyDemandDtos != null) {
                for (SciTechnologyDemandDto dto : sciTechnologyDemandDtos) {
                    String orgArea = dto.getOrgArea();
                    if (orgArea != null && orgArea.contains(";")) {
                        String[] array = orgArea.split(";");
                        dto.setOrgAreas(array);
                    } else {
                        String[] array = {};
                        dto.setOrgAreas(array);
                    }
                }
            }
            return sciTechnologyDemandDtos;
        } else {
            throw new BadRequestException("请输入正确的类型");
        }
    }

    public List<SciTechnologyDemandDto> getDemandsDostatusTop(Integer type) {
        String loginArea = getLoginArea();
        if (loginArea != null && !loginArea.equals("")) {
            String conLikeArea = conLikeArea(loginArea);
            if (conLikeArea != null && conLikeArea.contains(FJSCITY)) {
                List<SciTechnologyDemandDto> sciTechnologyDemandDtos = getdata7FJS(type, conLikeArea);
                return sciTechnologyDemandDtos;
            } else {
                List<SciTechnologyDemandDto> sciTechnologyDemandDtos = getdata7(type, conLikeArea);
                return sciTechnologyDemandDtos;
            }
        } else {
            return null;
        }
    }

    public IsAdminAreaDto userRoleIsSelect() {
        //TODO 根据登录用户是什么地区展示什么地区   admin返回所有
        try {
            Long userId = SecurityUtils.getCurrentUserId();
            Optional<User> res = userRepository.findById(userId);
            User user = res.get();
            Boolean isAdmin = user.getIsAdmin();
            if (isAdmin) {//admin用户看全部
                IsAdminAreaDto isAdminAreaDto = new IsAdminAreaDto();
                isAdminAreaDto.setIsAdmin(isAdmin);
                isAdminAreaDto.setOrgArea(user.getOrgArea());
                if (user.getOrgArea() != null) {
                    String[] split = user.getOrgArea().split(";");
                    isAdminAreaDto.setCount(split.length);
                }
                return isAdminAreaDto;
            } else {
                String orgArea = user.getOrgArea();
                if (orgArea != null && !orgArea.equals("")) {
                    //TODO 福建省的看到所有
                    if (orgArea.equals(fjsstr)) {
                        IsAdminAreaDto isAdminAreaDto = new IsAdminAreaDto();
                        isAdminAreaDto.setIsAdmin(false);
                        isAdminAreaDto.setOrgArea(fjsstr);
                        isAdminAreaDto.setCount(1);
                        return isAdminAreaDto;
                    } else {
                        String[] split = orgArea.split(";");
                        if (split.length == 2) {
                            IsAdminAreaDto isAdminAreaDto = new IsAdminAreaDto();
                            isAdminAreaDto.setIsAdmin(false);
                            isAdminAreaDto.setOrgArea(orgArea);
                            isAdminAreaDto.setCount(2);
                            return isAdminAreaDto;
                        } else if (split.length == 3) {
                            //如果是第三级只能查到自己
                            IsAdminAreaDto isAdminAreaDto = new IsAdminAreaDto();
                            isAdminAreaDto.setIsAdmin(false);
                            isAdminAreaDto.setOrgArea(orgArea);
                            isAdminAreaDto.setCount(3);
                            return isAdminAreaDto;
                        } else {
                            return null;
                        }
                    }
                } else {
                    return null;
                }
            }
        } catch (Exception e) {
            return null;
        }
    }

    int countSemicolons(String input) {
        // 将字符串按分号分割，并获取分割后的数组长度减一
        // 减一是因为split方法同时也会返回字符串之间的空字符串
        return input.split(";").length - 1;
    }


    public LastDataH5Dto getH5CriticalData(LargeH5AreaDto dto) {
        String[] orgArea = dto.getOrgArea();
        LastDataH5Dto lastDataH5Dto = new LastDataH5Dto();
        int zx = 0; //资讯
        int cxgzs = 0; //创新工作室
        int lmgjfwd = 0; //劳模工匠服务队
        int cxcgs = 0; //创新成果数
        int lmgjs = 0; //劳模工匠数
        int qyxqs = 0; //企业需求数
        int lls = 0; //浏览量
        int zcs = 0; //注册数
        String str = "";

        int flag = 0;

        if (orgArea == null || orgArea.equals("")) {
            //throw new BadRequestException("请输入正确的地区");
            //str = "福建省;";
            //flag = -1;
            lastDataH5Dto.setZx(zx);
            lastDataH5Dto.setCxgzs(cxgzs);
            lastDataH5Dto.setLmgjfwd(lmgjfwd);
            lastDataH5Dto.setCxcgs(cxcgs);
            lastDataH5Dto.setLmgjs(lmgjs);
            lastDataH5Dto.setQyxqs(qyxqs);
            lastDataH5Dto.setLll(lls);
            lastDataH5Dto.setZcs(zcs);
            return lastDataH5Dto;
        }
        if (orgArea.length == 0) {
            //str = "福建省;";
            //flag = -1;
            lastDataH5Dto.setZx(zx);
            lastDataH5Dto.setCxgzs(cxgzs);
            lastDataH5Dto.setLmgjfwd(lmgjfwd);
            lastDataH5Dto.setCxcgs(cxcgs);
            lastDataH5Dto.setLmgjs(lmgjs);
            lastDataH5Dto.setQyxqs(qyxqs);
            lastDataH5Dto.setLll(lls);
            lastDataH5Dto.setZcs(zcs);
            return lastDataH5Dto;
        }

        if (flag == 0) {
            if (orgArea.length == 1) {
                //直接拿去like
                str = orgArea[0];
            } else if (orgArea.length == 2) {
                //拿第第一个拼第二个去like
                str = orgArea[0] + ";" + orgArea[1];
            } else if (orgArea.length == 3) {
                //拿第一个拼第二个拼第三个去like
                str = orgArea[0] + ";" + orgArea[1] + ";" + orgArea[2];
            }
        }
        //TODO 比较
        IsAdminAreaDto isAdminAreaDto = userRoleIsSelect();
        if (isAdminAreaDto == null) {
            //不登录都不返回
            lastDataH5Dto.setZx(0);
            lastDataH5Dto.setCxgzs(0);
            lastDataH5Dto.setLmgjfwd(0);
            lastDataH5Dto.setCxcgs(0);
            lastDataH5Dto.setLmgjs(0);
            lastDataH5Dto.setQyxqs(0);
            lastDataH5Dto.setLll(0);
            lastDataH5Dto.setZcs(0);
            return lastDataH5Dto;
        } else {
            Boolean isAdmin = isAdminAreaDto.getIsAdmin();
            if (!isAdmin) {
                //不是admin才判断
                int count = isAdminAreaDto.getCount();
                String userOrgArea = isAdminAreaDto.getOrgArea();
                if (!str.contains(";")) {
                    //表示查福建省
                    if (userOrgArea.equals(fjsstr)) {

                    } else {
                        throw new BadRequestException("权限不足,无法查询该数据");
                    }
                } else {
                    int res = countSemicolons(str);
                    if (res == 1) {//表示2级
                        if (count == 3) { //权限3级查询不了2级
                            throw new BadRequestException("权限不足,无法查询该数据");
                        }
                        if (count == 2) {
                            String last = str + ";";
                            if (last.contains(userOrgArea)) {

                            } else {
                                throw new BadRequestException("权限不足,无法查询该数据");
                            }
                        }
                    }
                    if (res == 2) {
                        String last = str + ";";
                        if (last.contains(userOrgArea)) {

                        } else {
                            throw new BadRequestException("权限不足,无法查询该数据");
                        }
                    }
                }
            }
        }

        String lastStr = str;
        str = "%" + str + "%";


        lmgjs = sciPersonnelInfoRepository.findCountNormalByLikeArea(str, shtg);
        qyxqs = sciTechnologyDemandRepository.findCountNormalByLikeArea(str, shtg);
        if (str.contains("福州") || str.contains("福建")) {
            cxcgs = projectRepository.findCountNormalByLikeArea("%福州市%");
        } else {
            cxcgs = projectRepository.findCountNormalByLikeArea(str);
        }
        cxgzs = sciStudioRepository.findCountNormalByLikeArea(str, shtg);
        lmgjfwd = tsTeamRepository.findCountNormalByLikeArea(str, shtg);
        zx = noticeRepository.findCountNormalByLikeArea(str);
        zcs = userRepository.findCountNormalByLikeArea(str);//注册数
        if (str.equals("%福建省;福州市%") || str.equals("%福建省%") || str.equals("%福建省;%")) {
            zcs = zcs + 1800; //福建省 福州市额外加1800
        }


        if (lastStr.equals("福建省;") || lastStr.equals("福建省")) {
            lls = hotRecordRepository.findAllCounts();//浏览量
            lls = lls + 14000; //浏览量额外增加14000
        } else if (lastStr.equals("福建省;福州市;") || lastStr.equals("福建省;福州市")) {
            lls = hotRecordRepository.findCountNormalByLikeArea("%福州%");//浏览量
            lls = lls + 14000; //浏览量额外增加14000
        } else if (lastStr.contains("福建省;莆田市;") || lastStr.contains("福建省;莆田市")) {
            lls = hotRecordRepository.findCountNormalByLikeArea("%莆田%");//浏览量
        } else if (lastStr.contains("福建省;泉州市;") || lastStr.contains("福建省;泉州市")) {
            lls = hotRecordRepository.findCountNormalByLikeArea("%泉州%");//浏览量
        } else if (lastStr.contains("福建省;厦门市;") || lastStr.contains("福建省;厦门市")) {
            lls = hotRecordRepository.findCountNormalByLikeArea("%厦门%");//浏览量
        } else if (lastStr.contains("福建省;漳州市;") || lastStr.contains("福建省;漳州市")) {
            lls = hotRecordRepository.findCountNormalByLikeArea("%漳州%");//浏览量
        } else if (lastStr.contains("福建省;龙岩市;") || lastStr.contains("福建省;龙岩市")) {
            lls = hotRecordRepository.findCountNormalByLikeArea("%龙岩%");//浏览量
        } else if (lastStr.contains("福建省;三明市;") || lastStr.contains("福建省;三明市")) {
            lls = hotRecordRepository.findCountNormalByLikeArea("%三明%");//浏览量
        } else if (lastStr.contains("福建省;南平市;") || lastStr.contains("福建省;南平市")) {
            lls = hotRecordRepository.findCountNormalByLikeArea("%南平%");//浏览量
        } else if (lastStr.contains("福建省;宁德市;") || lastStr.contains("福建省;宁德市")) {
            lls = hotRecordRepository.findCountNormalByLikeArea("%宁德%");//浏览量
        } else if (lastStr.contains("福建省;平潭综合实验区;") || lastStr.contains("福建省;平潭综合实验区")) {
            lls = hotRecordRepository.findCountNormalByLikeArea("%平潭%");//浏览量
        } else {
            lls = 0;
        }


        lastDataH5Dto.setZx(zx);
        lastDataH5Dto.setCxgzs(cxgzs);
        lastDataH5Dto.setLmgjfwd(lmgjfwd);
        lastDataH5Dto.setCxcgs(cxcgs);
        lastDataH5Dto.setLmgjs(lmgjs);
        lastDataH5Dto.setQyxqs(qyxqs);
        lastDataH5Dto.setLll(lls);
        lastDataH5Dto.setZcs(zcs);
        return lastDataH5Dto;
    }


    public LargeXqH5Dto getH5XqData(LargeH5AreaDto dto) {
        String[] orgArea = dto.getOrgArea();
        LargeXqH5Dto largeXqH5Dto = new LargeXqH5Dto();
        int ppz = 0; //匹配中
        int ypp = 0; //已匹配
        int yjj = 0; //已解决

        String str = "";

        int flag = 0;

        if (orgArea == null || orgArea.equals("")) {
            //throw new BadRequestException("请输入正确的地区");
            //str = "福建省;";
            //flag = -1;
            largeXqH5Dto.setPpz(ppz);
            largeXqH5Dto.setYjj(yjj);
            largeXqH5Dto.setYpp(ypp);
            return largeXqH5Dto;
        }
        if (orgArea.length == 0) {
            //throw new BadRequestException("请输入正确的地区");
            //str = "福建省;";
            //flag = -1;
            largeXqH5Dto.setPpz(ppz);
            largeXqH5Dto.setYjj(yjj);
            largeXqH5Dto.setYpp(ypp);
            return largeXqH5Dto;
        }
        if (flag == 0) {
            if (orgArea.length == 1) {
                //直接拿去like
                str = orgArea[0];
            } else if (orgArea.length == 2) {
                //拿第第一个拼第二个去like
                str = orgArea[0] + ";" + orgArea[1];
            } else if (orgArea.length == 3) {
                //拿第一个拼第二个拼第三个去like
                str = orgArea[0] + ";" + orgArea[1] + ";" + orgArea[2];
            }
        }
        //TODO 比较
        IsAdminAreaDto isAdminAreaDto = userRoleIsSelect();
        if (isAdminAreaDto == null) {
            //不登录都不返回
            largeXqH5Dto.setPpz(0);
            largeXqH5Dto.setYjj(0);
            largeXqH5Dto.setYpp(0);
            return largeXqH5Dto;
        } else {
            Boolean isAdmin = isAdminAreaDto.getIsAdmin();
            if (!isAdmin) {
                //不是admin才判断
                int count = isAdminAreaDto.getCount();
                String userOrgArea = isAdminAreaDto.getOrgArea();
                if (!str.contains(";")) {
                    //表示查福建省
                    if (userOrgArea.equals(fjsstr)) {

                    } else {
                        throw new BadRequestException("权限不足,无法查询该数据");
                    }
                } else {
                    int res = countSemicolons(str);
                    if (res == 1) {//表示2级
                        if (count == 3) { //权限3级查询不了2级
                            throw new BadRequestException("权限不足,无法查询该数据");
                        }
                        if (count == 2) {
                            String last = str + ";";
                            if (last.contains(userOrgArea)) {

                            } else {
                                throw new BadRequestException("权限不足,无法查询该数据");
                            }
                        }
                    }
                    if (res == 2) {
                        String last = str + ";";
                        if (last.contains(userOrgArea)) {

                        } else {
                            throw new BadRequestException("权限不足,无法查询该数据");
                        }
                    }
                }
            }
        }

        str = "%" + str + "%";

        List<SciTechnologyDemand> ppzlist = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShow("%匹配中%", shtg, str);
        if (ppzlist != null) {
            ppz = ppzlist.size();
        }

        List<SciTechnologyDemand> ypplist = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShow("%已匹配%", shtg, str);
        if (ypplist != null) {
            ypp = ypplist.size();
        }

        List<SciTechnologyDemand> yjjlist = sciTechnologyDemandRepository.findNormalByLikeDoStatusWithOutIsShow("%已解决%", shtg, str);
        if (yjjlist != null) {
            yjj = yjjlist.size();
        }

        largeXqH5Dto.setPpz(ppz);
        largeXqH5Dto.setYjj(yjj);
        largeXqH5Dto.setYpp(ypp);
        return largeXqH5Dto;
    }


    public List<Object> getH5TimeArea2(LargeH5Dto dto) throws ParseException {
        String endTime = dto.getEndTime();
        String startTime = dto.getStartTime();
        String[] orgArea = dto.getOrgArea();

        int flag = 0;

        //LastH5Dto lastH5Dto = new LastH5Dto();

        int xqAll = 0;//需求总数
        int xqChange = 0;//需求新增  即新增-删除
        int xqDsh = 0;//需求新增待审核
        int lmAll = 0;//劳模总数
        int lmChange = 0;//劳模新增  即新增-删除
        int lmDsh = 0;//劳模新增待审核
        int proAll = 0;//创新成果总数
        int proChange = 0;//创新成果新增  即新增-删除
        int tsAll = 0;//技术服务队总数
        int tsChange = 0;//技术服务队新增  即新增-删除
        int tsDsh = 0;//技术服务队新增待审核
        int studioAll = 0;//创新工作室总数
        int studioChange = 0;//创新工作室新增  即新增-删除
        int studioDsh = 0;//创新工作室新增待审核
        int zxAll = 0;//资讯总数
        int zxChange = 0;//资讯新增
        int yipipei = 0;//需求 已匹配
        int xzyipipei = 0;//需求 新增已匹配
        int yijiejue = 0;//需求 已解决
        int xzyijiejue = 0;//需求  新增已解决

        String str = "";
        Date time1 = null;
        Date time2 = null;

        if (orgArea == null || orgArea.equals("")) {
            //throw new BadRequestException("请输入正确的地区");
            //str = "福建省;";
            //flag = -1;

            List<Object> list = new ArrayList<Object>();
            LinkedHashMap<String, Object> xq = new LinkedHashMap<String, Object>();
            xq.put("all", xqAll);
            xq.put("change", xqChange);
            xq.put("dsh", xqDsh);


            LinkedHashMap<String, Object> jsonMap1 = new LinkedHashMap<String, Object>();
            jsonMap1.put("title", "企业需求");
            jsonMap1.put("value", xq);
            list.add(jsonMap1);


            LinkedHashMap<String, Object> lm = new LinkedHashMap<String, Object>();
            lm.put("all", lmAll);
            lm.put("change", lmChange);
            lm.put("dsh", lmDsh);

            LinkedHashMap<String, Object> jsonMap2 = new LinkedHashMap<String, Object>();
            jsonMap2.put("title", "劳模工匠");
            jsonMap2.put("value", lm);
            list.add(jsonMap2);


            LinkedHashMap<String, Object> cg = new LinkedHashMap<String, Object>();
            cg.put("all", proAll);
            cg.put("change", proChange);

            LinkedHashMap<String, Object> jsonMap3 = new LinkedHashMap<String, Object>();
            jsonMap3.put("title", "创新成果");
            jsonMap3.put("value", cg);
            list.add(jsonMap3);


            LinkedHashMap<String, Object> ts = new LinkedHashMap<String, Object>();
            ts.put("all", tsAll);
            ts.put("change", tsChange);
            ts.put("dsh", tsDsh);

            LinkedHashMap<String, Object> jsonMap4 = new LinkedHashMap<String, Object>();
            jsonMap4.put("title", "劳模工匠服务队");
            jsonMap4.put("value", ts);
            list.add(jsonMap4);


            LinkedHashMap<String, Object> studio = new LinkedHashMap<String, Object>();
            studio.put("all", studioAll);
            studio.put("change", studioChange);
            studio.put("dsh", studioDsh);

            LinkedHashMap<String, Object> jsonMap5 = new LinkedHashMap<String, Object>();
            jsonMap5.put("title", "创新工作室");
            jsonMap5.put("value", studio);
            list.add(jsonMap5);


            LinkedHashMap<String, Object> zx = new LinkedHashMap<String, Object>();
            zx.put("all", zxAll);
            zx.put("change", zxChange);

            LinkedHashMap<String, Object> jsonMap6 = new LinkedHashMap<String, Object>();
            jsonMap6.put("title", "资讯");
            jsonMap6.put("value", zx);
            list.add(jsonMap6);

            return list;
        }

        if (orgArea.length == 0) {
            //throw new BadRequestException("请输入正确的地区");
            //str = "福建省;";
            //flag = -1;

            List<Object> list = new ArrayList<Object>();
            LinkedHashMap<String, Object> xq = new LinkedHashMap<String, Object>();
            xq.put("all", xqAll);
            xq.put("change", xqChange);
            xq.put("dsh", xqDsh);


            LinkedHashMap<String, Object> jsonMap1 = new LinkedHashMap<String, Object>();
            jsonMap1.put("title", "企业需求");
            jsonMap1.put("value", xq);
            list.add(jsonMap1);


            LinkedHashMap<String, Object> lm = new LinkedHashMap<String, Object>();
            lm.put("all", lmAll);
            lm.put("change", lmChange);
            lm.put("dsh", lmDsh);

            LinkedHashMap<String, Object> jsonMap2 = new LinkedHashMap<String, Object>();
            jsonMap2.put("title", "劳模工匠");
            jsonMap2.put("value", lm);
            list.add(jsonMap2);


            LinkedHashMap<String, Object> cg = new LinkedHashMap<String, Object>();
            cg.put("all", proAll);
            cg.put("change", proChange);

            LinkedHashMap<String, Object> jsonMap3 = new LinkedHashMap<String, Object>();
            jsonMap3.put("title", "创新成果");
            jsonMap3.put("value", cg);
            list.add(jsonMap3);


            LinkedHashMap<String, Object> ts = new LinkedHashMap<String, Object>();
            ts.put("all", tsAll);
            ts.put("change", tsChange);
            ts.put("dsh", tsDsh);

            LinkedHashMap<String, Object> jsonMap4 = new LinkedHashMap<String, Object>();
            jsonMap4.put("title", "劳模工匠服务队");
            jsonMap4.put("value", ts);
            list.add(jsonMap4);


            LinkedHashMap<String, Object> studio = new LinkedHashMap<String, Object>();
            studio.put("all", studioAll);
            studio.put("change", studioChange);
            studio.put("dsh", studioDsh);

            LinkedHashMap<String, Object> jsonMap5 = new LinkedHashMap<String, Object>();
            jsonMap5.put("title", "创新工作室");
            jsonMap5.put("value", studio);
            list.add(jsonMap5);


            LinkedHashMap<String, Object> zx = new LinkedHashMap<String, Object>();
            zx.put("all", zxAll);
            zx.put("change", zxChange);

            LinkedHashMap<String, Object> jsonMap6 = new LinkedHashMap<String, Object>();
            jsonMap6.put("title", "资讯");
            jsonMap6.put("value", zx);
            list.add(jsonMap6);

            return list;
        }

        //TODO 没传时间查今天  不传地区查福建省
        if (startTime == null || startTime.equals("")) {
            //throw new BadRequestException("请输入正确的开始时间");
            Calendar calendar = Calendar.getInstance();
            calendar.set(Calendar.HOUR_OF_DAY, 0);
            calendar.set(Calendar.MINUTE, 0);
            calendar.set(Calendar.SECOND, 0);
            calendar.set(Calendar.MILLISECOND, 0);
            time1 = calendar.getTime();
            flag = -1;
        }
        if (endTime == null || endTime.equals("")) {
            //throw new BadRequestException("请输入正确的结束时间");
            // 今天的23点59分59秒
            Calendar calendar = Calendar.getInstance();
            calendar.set(Calendar.HOUR_OF_DAY, 23);
            calendar.set(Calendar.MINUTE, 59);
            calendar.set(Calendar.SECOND, 59);
            time2 = calendar.getTime();
            flag = -1;
        }


        if (flag == 0) {
            if (orgArea.length == 1) {
                //直接拿去like
                str = orgArea[0];
            } else if (orgArea.length == 2) {
                //拿第第一个拼第二个去like
                str = orgArea[0] + ";" + orgArea[1];
            } else if (orgArea.length == 3) {
                //拿第一个拼第二个拼第三个去like
                str = orgArea[0] + ";" + orgArea[1] + ";" + orgArea[2];
            }

            String aTime = startTime + " 00:00:00";
            String bTime = endTime + " 23:59:59";
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            time1 = formatter.parse(aTime);
            time2 = formatter.parse(bTime);
        }

        //TODO 比较
        IsAdminAreaDto isAdminAreaDto = userRoleIsSelect();
        if (isAdminAreaDto == null) {
            //不登录都不返回
            List<Object> list = new ArrayList<Object>();
            LinkedHashMap<String, Object> xq = new LinkedHashMap<String, Object>();
            xq.put("all", xqAll);
            xq.put("change", xqChange);
            xq.put("dsh", xqDsh);


            LinkedHashMap<String, Object> jsonMap1 = new LinkedHashMap<String, Object>();
            jsonMap1.put("title", "企业需求");
            jsonMap1.put("value", xq);
            list.add(jsonMap1);


            LinkedHashMap<String, Object> lm = new LinkedHashMap<String, Object>();
            lm.put("all", lmAll);
            lm.put("change", lmChange);
            lm.put("dsh", lmDsh);

            LinkedHashMap<String, Object> jsonMap2 = new LinkedHashMap<String, Object>();
            jsonMap2.put("title", "劳模工匠");
            jsonMap2.put("value", lm);
            list.add(jsonMap2);


            LinkedHashMap<String, Object> cg = new LinkedHashMap<String, Object>();
            cg.put("all", proAll);
            cg.put("change", proChange);

            LinkedHashMap<String, Object> jsonMap3 = new LinkedHashMap<String, Object>();
            jsonMap3.put("title", "创新成果");
            jsonMap3.put("value", cg);
            list.add(jsonMap3);


            LinkedHashMap<String, Object> ts = new LinkedHashMap<String, Object>();
            ts.put("all", tsAll);
            ts.put("change", tsChange);
            ts.put("dsh", tsDsh);

            LinkedHashMap<String, Object> jsonMap4 = new LinkedHashMap<String, Object>();
            jsonMap4.put("title", "劳模工匠服务队");
            jsonMap4.put("value", ts);
            list.add(jsonMap4);


            LinkedHashMap<String, Object> studio = new LinkedHashMap<String, Object>();
            studio.put("all", studioAll);
            studio.put("change", studioChange);
            studio.put("dsh", studioDsh);

            LinkedHashMap<String, Object> jsonMap5 = new LinkedHashMap<String, Object>();
            jsonMap5.put("title", "创新工作室");
            jsonMap5.put("value", studio);
            list.add(jsonMap5);


            LinkedHashMap<String, Object> zx = new LinkedHashMap<String, Object>();
            zx.put("all", zxAll);
            zx.put("change", zxChange);

            LinkedHashMap<String, Object> jsonMap6 = new LinkedHashMap<String, Object>();
            jsonMap6.put("title", "资讯");
            jsonMap6.put("value", zx);
            list.add(jsonMap6);

            return list;
        } else {
            Boolean isAdmin = isAdminAreaDto.getIsAdmin();
            if (!isAdmin) {
                //不是admin才判断
                int count = isAdminAreaDto.getCount();
                String userOrgArea = isAdminAreaDto.getOrgArea();
                if (!str.contains(";")) {
                    //表示查福建省
                    if (userOrgArea.equals(fjsstr)) {

                    } else {
                        throw new BadRequestException("权限不足,无法查询该数据");
                    }
                } else {
                    int res = countSemicolons(str);
                    if (res == 1) {//表示2级
                        if (count == 3) { //权限3级查询不了2级
                            throw new BadRequestException("权限不足,无法查询该数据");
                        }
                        if (count == 2) {
                            String last = str + ";";
                            if (last.contains(userOrgArea)) {

                            } else {
                                throw new BadRequestException("权限不足,无法查询该数据");
                            }
                        }
                    }
                    if (res == 2) {
                        String last = str + ";";
                        if (last.contains(userOrgArea)) {

                        } else {
                            throw new BadRequestException("权限不足,无法查询该数据");
                        }
                    }
                }
            }
        }

        str = "%" + str + "%";

        //TODO 查询所有需求状态正常 切审核通过  切like 地区
        List<SciTechnologyDemand> listNormal = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShow(str, shtg);
        if (listNormal != null && listNormal.size() > 0) {
            for (SciTechnologyDemand sciTechnologyDemand : listNormal) {

                int c1 = sciTechnologyDemandPpLogRepository.findNormalByTime(sciTechnologyDemand.getId(), "%已匹配%", time2);
                int c2 = sciTechnologyDemandPpLogRepository.findNormalByTime(sciTechnologyDemand.getId(), "%已解决%", time2);
                yipipei = yipipei + c1;
                yijiejue = yijiejue + c2;

                int c3 = sciTechnologyDemandPpLogRepository.findNormalByTimeWithEtime(sciTechnologyDemand.getId(), "%已匹配%", time1, time2);
                int c4 = sciTechnologyDemandPpLogRepository.findNormalByTimeWithEtime(sciTechnologyDemand.getId(), "%已解决%", time1, time2);
                xzyipipei = xzyipipei + c3;
                xzyijiejue = xzyijiejue + c4;
            }
        }


        //TODO 所有的总数算到 结束时间为止 并like orgArea
        lmAll = sciPersonnelInfoRepository.findCountNormalByLikeAreaWithTime(str, shtg, time2);
        xqAll = sciTechnologyDemandRepository.findCountNormalByLikeAreaWithTime(str, shtg, time2);
        if (str.contains("福州") || str.contains("福建")) {
            proAll = projectRepository.findCountNormalByLikeAreaWithTime("%福州市%", time2);

            int a7 = projectRepository.findNormalByLikeAreaWithOutIsShowCSevenCreate("%福州市%", time1, time2);
            int a8 = projectRepository.findNormalByLikeAreaWithOutIsShowDSevenDel("%福州市%", time1, time2);
            proChange = a7 - a8;
        } else {
            proAll = projectRepository.findCountNormalByLikeAreaWithTime(str, time2);

            int a7 = projectRepository.findNormalByLikeAreaWithOutIsShowCSevenCreate(str, time1, time2);
            int a8 = projectRepository.findNormalByLikeAreaWithOutIsShowDSevenDel(str, time1, time2);
            proChange = a7 - a8;
        }
        studioAll = sciStudioRepository.findCountNormalByLikeAreaWithTime(str, shtg, time2);
        tsAll = tsTeamRepository.findCountNormalByLikeAreaWithTime(str, shtg, time2);
        zxAll = noticeRepository.findCountNormalByLikeAreaWithTime(str, time2);

        //TODO 新增 新增-删除的 算为增量
        int a1 = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShowCSevenCreate(str, shtg, time1, time2);
        int a2 = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShowDSevenDel(str, shtg, time1, time2);
        xqChange = a1 - a2;

        int a3 = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShowCSevenCreate(str, shtg, time1, time2);
        int a4 = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShowDSevenDel(str, shtg, time1, time2);
        lmChange = a3 - a4;

        int a5 = tsTeamRepository.findNormalByLikeAreaWithOutIsShowCSevenCreate(str, shtg, time1, time2);
        int a6 = tsTeamRepository.findNormalByLikeAreaWithOutIsShowDSevenDel(str, shtg, time1, time2);
        tsChange = a5 - a6;


        int a9 = sciStudioRepository.findNormalByLikeAreaWithOutIsShowCSevenCreate(str, shtg, time1, time2);
        int a10 = sciStudioRepository.findNormalByLikeAreaWithOutIsShowDSevenDel(str, shtg, time1, time2);
        studioChange = a9 - a10;

        int a11 = noticeRepository.findNormalByLikeAreaWithOutIsShowCSevenCreate(str, time1, time2);
        int a12 = noticeRepository.findNormalByLikeAreaWithOutIsShowDSevenDel(str, time1, time2);
        zxChange = a11 - a12;


        //TODO 待审核 时间段内待审核的数据   待审核不算开始时间
        lmDsh = sciPersonnelInfoRepository.findNormalByLikeAreaWithOutIsShowCSevenCreateLikeDshWithOutS(str, "%待审核%", time2);
        xqDsh = sciTechnologyDemandRepository.findNormalByLikeAreaWithOutIsShowCSevenCreateLikeDshWithOutS(str, "%待审核%", time2);
        tsDsh = tsTeamRepository.findNormalByLikeAreaWithOutIsShowCSevenCreateLikeDshWithOutS(str, "%待审核%", time2);
        studioDsh = sciStudioRepository.findNormalByLikeAreaWithOutIsShowCSevenCreateLikeDshWithOutS(str, "%待审核%", time2);

        /*lastH5Dto.setXqAll(xqAll);
        lastH5Dto.setXqChange(xqChange);
        lastH5Dto.setXqDsh(xqDsh);
        lastH5Dto.setLmAll(lmAll);
        lastH5Dto.setLmChange(lmChange);
        lastH5Dto.setLmDsh(lmDsh);
        lastH5Dto.setProAll(proAll);
        lastH5Dto.setProChange(proChange);
        lastH5Dto.setTsAll(tsAll);
        lastH5Dto.setTsChange(tsChange);
        lastH5Dto.setTsDsh(tsDsh);
        lastH5Dto.setStudioAll(studioAll);
        lastH5Dto.setStudioChange(studioChange);
        lastH5Dto.setStudioDsh(studioDsh);
        lastH5Dto.setZxAll(zxAll);
        lastH5Dto.setZxChange(zxChange);*/


        List<Object> list = new ArrayList<Object>();
        LinkedHashMap<String, Object> xq = new LinkedHashMap<String, Object>();
        xq.put("all", xqAll);
        xq.put("change", xqChange);
        xq.put("dsh", xqDsh);
        //注释
        /*xq.put("yipipei", yipipei);
        xq.put("xzyipipei", xzyipipei);
        xq.put("yijiejue", yijiejue);
        xq.put("xzyijiejue", xzyijiejue);*/


        LinkedHashMap<String, Object> jsonMap1 = new LinkedHashMap<String, Object>();
        jsonMap1.put("title", "企业需求");
        jsonMap1.put("value", xq);
        list.add(jsonMap1);


        LinkedHashMap<String, Object> lm = new LinkedHashMap<String, Object>();
        lm.put("all", lmAll);
        lm.put("change", lmChange);
        lm.put("dsh", lmDsh);

        LinkedHashMap<String, Object> jsonMap2 = new LinkedHashMap<String, Object>();
        jsonMap2.put("title", "劳模工匠");
        jsonMap2.put("value", lm);
        list.add(jsonMap2);


        LinkedHashMap<String, Object> cg = new LinkedHashMap<String, Object>();
        cg.put("all", proAll);
        cg.put("change", proChange);

        LinkedHashMap<String, Object> jsonMap3 = new LinkedHashMap<String, Object>();
        jsonMap3.put("title", "创新成果");
        jsonMap3.put("value", cg);
        list.add(jsonMap3);


        LinkedHashMap<String, Object> ts = new LinkedHashMap<String, Object>();
        ts.put("all", tsAll);
        ts.put("change", tsChange);
        ts.put("dsh", tsDsh);

        LinkedHashMap<String, Object> jsonMap4 = new LinkedHashMap<String, Object>();
        jsonMap4.put("title", "劳模工匠服务队");
        jsonMap4.put("value", ts);
        list.add(jsonMap4);


        LinkedHashMap<String, Object> studio = new LinkedHashMap<String, Object>();
        studio.put("all", studioAll);
        studio.put("change", studioChange);
        studio.put("dsh", studioDsh);

        LinkedHashMap<String, Object> jsonMap5 = new LinkedHashMap<String, Object>();
        jsonMap5.put("title", "创新工作室");
        jsonMap5.put("value", studio);
        list.add(jsonMap5);


        LinkedHashMap<String, Object> zx = new LinkedHashMap<String, Object>();
        zx.put("all", zxAll);
        zx.put("change", zxChange);

        LinkedHashMap<String, Object> jsonMap6 = new LinkedHashMap<String, Object>();
        jsonMap6.put("title", "资讯");
        jsonMap6.put("value", zx);
        list.add(jsonMap6);

        return list;
        //return lastH5Dto;
    }

    public Date getSevenAgoTime() {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, -7); // 将当前日期回退7天
        Date sevenDaysBefore = calendar.getTime(); // 获取回退后的时间
        return sevenDaysBefore;
    }

    public List<DataModel> getH5ModelZxByArea(LargeH5AreaDto dto) {
        String[] orgArea = dto.getOrgArea();
        String str = "";

        int flag = 0;

        if (orgArea == null || orgArea.equals("")) {
            //throw new BadRequestException("请输入正确的地区");
            str = "福建省;";
            flag = -1;
        }
        if (flag == 0) {
            if (orgArea.length == 0) {
                str = "福建省;";
            } else if (orgArea.length == 1) {
                //直接拿去like
                str = orgArea[0] + ";";
            } else if (orgArea.length == 2) {
                //拿第第一个拼第二个去like
                str = orgArea[0] + ";" + orgArea[1] + ";";
            } else if (orgArea.length == 3) {
                //拿第一个拼第二个拼第三个去like
                str = orgArea[0] + ";" + orgArea[1] + ";" + orgArea[2] + ";";
            }
        }
        //TODO 不能用like只能等于
        //str = "%" + str + "%";

        List<DataModel> dataModels = dataModelRepository.queryByOrgAreaEqWithTime(str, getSevenAgoTime(), new Date());
        return dataModels;
    }

    public List<DataXq> getH5XqZxByArea(LargeH5AreaDto dto) {
        String[] orgArea = dto.getOrgArea();
        String str = "";
        String str2 = "";

        int flag = 0;

        //TODO 如果传null 则返回没有数据
        if (orgArea == null || orgArea.equals("")) {
            List<DataXq> list = new ArrayList<DataXq>();
            return list;

            //throw new BadRequestException("请输入正确的地区");
            //str = "福建省;";
            //flag = -1;
        }
        if (flag == 0) {
            if (orgArea.length == 0) {
                str = "福建省;";
                str2 = "福建省";
            } else if (orgArea.length == 1) {
                //直接拿去like
                str = orgArea[0] + ";";
                str2 = orgArea[0];
            } else if (orgArea.length == 2) {
                //拿第第一个拼第二个去like
                str = orgArea[0] + ";" + orgArea[1] + ";";
                str2 = orgArea[0] + ";" + orgArea[1];
            } else if (orgArea.length == 3) {
                //拿第一个拼第二个拼第三个去like
                str = orgArea[0] + ";" + orgArea[1] + ";" + orgArea[2] + ";";
                str2 = orgArea[0] + ";" + orgArea[1] + ";" + orgArea[2];
            }
        }
        //TODO 比较
        IsAdminAreaDto isAdminAreaDto = userRoleIsSelect();
        if (isAdminAreaDto == null) {
            List<DataXq> list = new ArrayList<DataXq>();
            return list;
        } else {
            Boolean isAdmin = isAdminAreaDto.getIsAdmin();
            if (!isAdmin) {
                //不是admin才判断
                int count = isAdminAreaDto.getCount();
                String userOrgArea = isAdminAreaDto.getOrgArea();
                if (!str2.contains(";")) {
                    //表示查福建省
                    if (userOrgArea.equals(fjsstr)) {

                    } else {
                        //throw new BadRequestException("权限不足,无法查询该数据");
                        List<DataXq> list = new ArrayList<DataXq>();
                        return list;
                    }
                } else {
                    int res = countSemicolons(str2);
                    if (res == 1) {//表示2级
                        if (count == 3) { //权限3级查询不了2级
                            //throw new BadRequestException("权限不足,无法查询该数据");
                            List<DataXq> list = new ArrayList<DataXq>();
                            return list;
                        }
                        if (count == 2) {
                            String last = str2 + ";";
                            if (last.contains(userOrgArea)) {

                            } else {
                                //throw new BadRequestException("权限不足,无法查询该数据");
                                List<DataXq> list = new ArrayList<DataXq>();
                                return list;
                            }
                        }
                    }
                    if (res == 2) {
                        String last = str2 + ";";
                        if (last.contains(userOrgArea)) {

                        } else {
                            //throw new BadRequestException("权限不足,无法查询该数据");
                            List<DataXq> list = new ArrayList<DataXq>();
                            return list;
                        }
                    }
                }
            }
        }

        //str = "%" + str + "%";

        return dataXqRepository.queryByOrgAreaEqWithTime(str, getSevenAgoTime(), new Date());
    }

    public List<DataTs> getH5XqTsByArea(LargeH5AreaDto dto) {
        String[] orgArea = dto.getOrgArea();
        String str = "";

        int flag = 0;

        if (orgArea == null || orgArea.equals("")) {
            //throw new BadRequestException("请输入正确的地区");
            str = "福建省;";
            flag = -1;
        }
        if (flag == 0) {
            if (orgArea.length == 0) {
                str = "福建省;";
            } else if (orgArea.length == 1) {
                //直接拿去like
                str = orgArea[0] + ";";
            } else if (orgArea.length == 2) {
                //拿第第一个拼第二个去like
                str = orgArea[0] + ";" + orgArea[1] + ";";
            } else if (orgArea.length == 3) {
                //拿第一个拼第二个拼第三个去like
                str = orgArea[0] + ";" + orgArea[1] + ";" + orgArea[2] + ";";
            }
        }

        //str = "%" + str + "%";

        return dataTsRepository.queryByOrgAreaEqWithTime(str, getSevenAgoTime(), new Date());
    }

    public List<DataZx> getH5ZxZxByArea(LargeH5AreaDto dto) {
        String[] orgArea = dto.getOrgArea();
        String str = "";

        int flag = 0;

        if (orgArea == null || orgArea.equals("")) {
            //throw new BadRequestException("请输入正确的地区");
            str = "福建省;";
            flag = -1;
        }
        if (flag == 0) {
            if (orgArea.length == 0) {
                str = "福建省;";
            } else if (orgArea.length == 1) {
                //直接拿去like
                str = orgArea[0] + ";";
            } else if (orgArea.length == 2) {
                //拿第第一个拼第二个去like
                str = orgArea[0] + ";" + orgArea[1] + ";";
            } else if (orgArea.length == 3) {
                //拿第一个拼第二个拼第三个去like
                str = orgArea[0] + ";" + orgArea[1] + ";" + orgArea[2] + ";";
            }
        }

        //str = "%" + str + "%";

        return dataZxRepository.queryByOrgAreaEqWithTime(str, getSevenAgoTime(), new Date());
    }

    public List<DataCg> getH5CgZxByArea(LargeH5AreaDto dto) {
        String[] orgArea = dto.getOrgArea();
        String str = "";

        int flag = 0;

        if (orgArea == null || orgArea.equals("")) {
            //throw new BadRequestException("请输入正确的地区");
            str = "福建省;";
            flag = -1;
        }
        if (flag == 0) {
            if (orgArea.length == 0) {
                str = "福建省;";
            } else if (orgArea.length == 1) {
                //直接拿去like
                str = orgArea[0] + ";";
            } else if (orgArea.length == 2) {
                //拿第第一个拼第二个去like
                str = orgArea[0] + ";" + orgArea[1] + ";";
            } else if (orgArea.length == 3) {
                //拿第一个拼第二个拼第三个去like
                str = orgArea[0] + ";" + orgArea[1] + ";" + orgArea[2] + ";";
            }
        }

        //str = "%" + str + "%";

        return dataCgRepository.queryByOrgAreaEqWithTime(str, getSevenAgoTime(), new Date());
    }

    public List<DataStudio> getH5StudioZxByArea(LargeH5AreaDto dto) {
        String[] orgArea = dto.getOrgArea();
        String str = "";

        int flag = 0;

        if (orgArea == null || orgArea.equals("")) {
            //throw new BadRequestException("请输入正确的地区");
            str = "福建省;";
            flag = -1;
        }
        if (flag == 0) {
            if (orgArea.length == 0) {
                str = "福建省;";
            } else if (orgArea.length == 1) {
                //直接拿去like
                str = orgArea[0] + ";";
            } else if (orgArea.length == 2) {
                //拿第第一个拼第二个去like
                str = orgArea[0] + ";" + orgArea[1] + ";";
            } else if (orgArea.length == 3) {
                //拿第一个拼第二个拼第三个去like
                str = orgArea[0] + ";" + orgArea[1] + ";" + orgArea[2] + ";";
            }
        }

        //str = "%" + str + "%";

        return dataStudioRepository.queryByOrgAreaEqWithTime(str, getSevenAgoTime(), new Date());
    }

    public List<DataLls> getH5LllZxByArea(LargeH5AreaDto dto) {
        String[] orgArea = dto.getOrgArea();
        String str = "";

        int flag = 0;

        if (orgArea == null || orgArea.equals("")) {
            //throw new BadRequestException("请输入正确的地区");
            str = "福建省;";
            flag = -1;
        }
        if (flag == 0) {
            if (orgArea.length == 0) {
                str = "福建省;";
            } else if (orgArea.length == 1) {
                //直接拿去like
                str = orgArea[0] + ";";
            } else if (orgArea.length == 2) {
                //拿第第一个拼第二个去like
                str = orgArea[0] + ";" + orgArea[1] + ";";
            } else if (orgArea.length == 3) {
                //拿第一个拼第二个拼第三个去like
                str = orgArea[0] + ";" + orgArea[1] + ";" + orgArea[2] + ";";
            }
        }

        //str = "%" + str + "%";

        return dataLlsRepository.queryByOrgAreaEqWithTime(str, getSevenAgoTime(), new Date());
    }

    public List<DataZcs> getH5ZclZxByArea(LargeH5AreaDto dto) {
        String[] orgArea = dto.getOrgArea();
        String str = "";

        int flag = 0;

        if (orgArea == null || orgArea.equals("")) {
            //throw new BadRequestException("请输入正确的地区");
            str = "福建省;";
            flag = -1;
        }
        if (flag == 0) {
            if (orgArea.length == 0) {
                str = "福建省;";
            } else if (orgArea.length == 1) {
                //直接拿去like
                str = orgArea[0] + ";";
            } else if (orgArea.length == 2) {
                //拿第第一个拼第二个去like
                str = orgArea[0] + ";" + orgArea[1] + ";";
            } else if (orgArea.length == 3) {
                //拿第一个拼第二个拼第三个去like
                str = orgArea[0] + ";" + orgArea[1] + ";" + orgArea[2] + ";";
            }
        }

        //str = "%" + str + "%";

        return dataZcsRepository.queryByOrgAreaEqWithTime(str, getSevenAgoTime(), new Date());
    }
}